CSES - Leirikisa 1 - Results
Submission details
Task:organizator
Sender:Hansuzu
Submission time:2016-07-27 16:10:07 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.07 sdetails
#2ACCEPTED0.08 sdetails
#3ACCEPTED0.07 sdetails
#4ACCEPTED0.07 sdetails
#5ACCEPTED0.07 sdetails
#6ACCEPTED0.09 sdetails
#7--details
#8--details
#9--details
#10--details
#11--details
#12--details
#13--details
#14--details
#15--details
#16--details
#17--details
#18--details
#19--details

Compiler report

input/code.cpp: In function 'void h(int)':
input/code.cpp:27:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<ctkj.size(); ++i){
                             ^

Code

#include <iostream>
#include <set>
#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);
  int w=c;
  
  while (p[w]!=w){
    for (int i=p[w]; i<c; i+=p[w]){
      if (c%i==0)ctkj.push_back(i);
    }
    w/=p[w];
  }
  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=2; 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: ACCEPTED

input
20
53 76 25 71 43 40 97 17 46 26 ...

correct output
55440

user output
55440

Test 7

Verdict:

input
10000
2000000 2973 1884960 1965600 1...

correct output
998000000

user output
(empty)

Test 8

Verdict:

input
20000
1867320 1801800 2000000 3516 4...

correct output
2039360400

user output
(empty)

Test 9

Verdict:

input
100000
321799 200309 451017 114778 35...

correct output
8436000

user output
(empty)

Test 10

Verdict:

input
50000
1542240 87374 1729728 1113840 ...

correct output
522849600

user output
(empty)

Test 11

Verdict:

input
100000
570304 521109 689931 17250 990...

correct output
149985000

user output
(empty)

Test 12

Verdict:

input
50000
1834560 1544400 1912680 111384...

correct output
1056000000

user output
(empty)

Test 13

Verdict:

input
100001
104442 560941 1492871 1412995 ...

correct output
2104046616

user output
(empty)

Test 14

Verdict:

input
140000
396519 779335 1220726 633419 1...

correct output
2666109600

user output
(empty)

Test 15

Verdict:

input
150000
199004 279001 1791639 1789810 ...

correct output
1283381061

user output
(empty)

Test 16

Verdict:

input
150000
1940400 1867320 1965600 141372...

correct output
27926000000

user output
(empty)

Test 17

Verdict:

input
200000
634553 1387738 1923797 748376 ...

correct output
41201433

user output
(empty)

Test 18

Verdict:

input
200000
1663200 1995840 1289302 136634...

correct output
37890000000

user output
(empty)

Test 19

Verdict:

input
200000
1079365 1094819 909761 1877190...

correct output
179428140

user output
(empty)