Task: | organizator |
Sender: | Hansuzu |
Submission time: | 2016-07-27 16:32:14 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.07 s | details |
#3 | ACCEPTED | 0.06 s | details |
#4 | ACCEPTED | 0.07 s | details |
#5 | ACCEPTED | 0.08 s | details |
#6 | WRONG ANSWER | 0.07 s | details |
#7 | ACCEPTED | 0.08 s | details |
#8 | ACCEPTED | 0.10 s | details |
#9 | ACCEPTED | 0.14 s | details |
#10 | ACCEPTED | 0.14 s | details |
#11 | ACCEPTED | 0.14 s | details |
#12 | ACCEPTED | 0.17 s | details |
#13 | ACCEPTED | 0.14 s | details |
#14 | ACCEPTED | 0.20 s | details |
#15 | ACCEPTED | 0.17 s | details |
#16 | ACCEPTED | 0.31 s | details |
#17 | ACCEPTED | 0.21 s | details |
#18 | ACCEPTED | 0.41 s | details |
#19 | ACCEPTED | 0.21 s | details |
Compiler report
input/code.cpp: In function 'void h(int)': input/code.cpp:30:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0; i<ctkj.size(); ++i){ ^
Code
#include <iostream> #include <vector> #include <algorithm> using namespace std; int N; int p[2111333]; int gcd[2111333]; vector<int> ctkj; void h(int c){ ctkj.clear(); ctkj.push_back(c); ctkj.push_back(1); int w=c; while (p[w]!=w && w>1){ for (int i=c/p[w]; i && c%i==0; i/=p[w]){ ctkj.push_back(i); } w/=p[w]; } if (w!=1) for (int i=c/p[w]; i && c%i==0; i/=p[w]) ctkj.push_back(i); sort(ctkj.begin(), ctkj.end()); int pr=-100; for (int i=0; i<ctkj.size(); ++i){ if (ctkj[i]!=pr){ ++gcd[ctkj[i]]; } pr=ctkj[i]; } } long long ans=2; int main(){ p[0]=p[1]=1; for (int i=2; i<2111333; ++i){ if (p[i]) continue; p[i]=i; for (int j=i+i; j<2111333; j+=i){ p[j]=i; } } cin >> N; for (int i=0; i<N; ++i){ int w; cin >> w; h(w); } for (int i=1; i<2111333; ++i){ if (gcd[i]>1) ans=max(ans, (long long)gcd[i]*i); } cout << ans << "\n"; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3
1 2 4 |
correct output |
---|
4 |
user output |
---|
4 |
Test 2
Verdict: ACCEPTED
input |
---|
2
1 5 |
correct output |
---|
2 |
user output |
---|
2 |
Test 3
Verdict: ACCEPTED
input |
---|
5
4 6 3 8 9 |
correct output |
---|
9 |
user output |
---|
9 |
Test 4
Verdict: ACCEPTED
input |
---|
100
988 6833 9309 8541 1265 9449 5... |
correct output |
---|
14432 |
user output |
---|
14432 |
Test 5
Verdict: ACCEPTED
input |
---|
1000
167 60 170 502 971 2759 1790 1... |
correct output |
---|
12963 |
user output |
---|
12963 |
Test 6
Verdict: WRONG ANSWER
input |
---|
20
53 76 25 71 43 40 97 17 46 26 ... |
correct output |
---|
55440 |
user output |
---|
192 |
Test 7
Verdict: ACCEPTED
input |
---|
10000
2000000 2973 1884960 1965600 1... |
correct output |
---|
998000000 |
user output |
---|
998000000 |
Test 8
Verdict: ACCEPTED
input |
---|
20000
1867320 1801800 2000000 3516 4... |
correct output |
---|
2039360400 |
user output |
---|
2039360400 |
Test 9
Verdict: ACCEPTED
input |
---|
100000
321799 200309 451017 114778 35... |
correct output |
---|
8436000 |
user output |
---|
8436000 |
Test 10
Verdict: ACCEPTED
input |
---|
50000
1542240 87374 1729728 1113840 ... |
correct output |
---|
522849600 |
user output |
---|
522849600 |
Test 11
Verdict: ACCEPTED
input |
---|
100000
570304 521109 689931 17250 990... |
correct output |
---|
149985000 |
user output |
---|
149985000 |
Test 12
Verdict: ACCEPTED
input |
---|
50000
1834560 1544400 1912680 111384... |
correct output |
---|
1056000000 |
user output |
---|
1056000000 |
Test 13
Verdict: ACCEPTED
input |
---|
100001
104442 560941 1492871 1412995 ... |
correct output |
---|
2104046616 |
user output |
---|
2104046616 |
Test 14
Verdict: ACCEPTED
input |
---|
140000
396519 779335 1220726 633419 1... |
correct output |
---|
2666109600 |
user output |
---|
2666109600 |
Test 15
Verdict: ACCEPTED
input |
---|
150000
199004 279001 1791639 1789810 ... |
correct output |
---|
1283381061 |
user output |
---|
1283381061 |
Test 16
Verdict: ACCEPTED
input |
---|
150000
1940400 1867320 1965600 141372... |
correct output |
---|
27926000000 |
user output |
---|
27926000000 |
Test 17
Verdict: ACCEPTED
input |
---|
200000
634553 1387738 1923797 748376 ... |
correct output |
---|
41201433 |
user output |
---|
41201433 |
Test 18
Verdict: ACCEPTED
input |
---|
200000
1663200 1995840 1289302 136634... |
correct output |
---|
37890000000 |
user output |
---|
37890000000 |
Test 19
Verdict: ACCEPTED
input |
---|
200000
1079365 1094819 909761 1877190... |
correct output |
---|
179428140 |
user output |
---|
179428140 |