mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 17:18:49 +00:00
parent
93e76807c0
commit
b3f60c8d77
67
S2OJ/1548/1548.cpp
Normal file
67
S2OJ/1548/1548.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <random>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e5 + 5;
|
||||
|
||||
int n;
|
||||
long long w[N], ans;
|
||||
std::mt19937 rng(std::random_device{}());
|
||||
|
||||
int random(int l, int r) {
|
||||
return std::uniform_int_distribution<int>(l, r)(rng);
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> w[i];
|
||||
}
|
||||
|
||||
while (clock() <= 0.6 * CLOCKS_PER_SEC) {
|
||||
int p = random(1, n);
|
||||
|
||||
std::unordered_map<long long, int> cnt;
|
||||
std::vector<long long> v;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cnt[std::__gcd(w[i], w[p])]++;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= w[p] / i; i++) {
|
||||
if (w[p] % i == 0) {
|
||||
v.push_back(i);
|
||||
if ((w[p] / i) != i) v.push_back(w[p] / i);
|
||||
}
|
||||
}
|
||||
|
||||
for (long long x : v) {
|
||||
int sum = 0;
|
||||
|
||||
for (long long y : v) {
|
||||
if (y % x == 0) {
|
||||
sum += cnt[y];
|
||||
}
|
||||
}
|
||||
|
||||
if (sum >= (n + 1) / 2) {
|
||||
ans = std::max(ans, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1548/data/data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data26.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data27.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data28.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data29.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data30.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/data9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/data9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/ex_data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/ex_data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/ex_data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/ex_data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/ex_data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/ex_data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/ex_data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/ex_data2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/ex_data3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/ex_data3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/ex_data3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/ex_data3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1548/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1548/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user