CSES - Leirikisa 1 - Results
Submission details
Task:organizator
Sender:Hansuzu
Submission time:2016-07-27 16:21:11 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.28 sdetails
#20.28 sdetails
#3ACCEPTED0.07 sdetails
#4ACCEPTED0.02 sdetails
#5ACCEPTED0.07 sdetails
#60.07 sdetails
#70.28 sdetails
#80.28 sdetails
#9ACCEPTED0.15 sdetails
#10ACCEPTED0.12 sdetails
#11ACCEPTED0.14 sdetails
#12ACCEPTED0.16 sdetails
#13ACCEPTED0.14 sdetails
#14ACCEPTED0.18 sdetails
#15ACCEPTED0.17 sdetails
#16ACCEPTED0.31 sdetails
#17ACCEPTED0.21 sdetails
#18ACCEPTED0.38 sdetails
#19ACCEPTED0.22 sdetails

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);
  int w=c;
  
  while (p[w]!=w){
    for (int i=c/p[w]; i && c%i==0; i/=p[w]){
      ctkj.push_back(i);
    }
    w/=p[w];
  }
  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=2; i<2111333; ++i){
    if (gcd[i]>1) ans=max(ans, (long long)gcd[i]*i);
  }
  cout << ans << "\n";
}

Test details

Test 1

Verdict:

input
3
1 2 4

correct output
4

user output
(empty)

Test 2

Verdict:

input
2
1 5

correct output
2

user output
(empty)

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:

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

correct output
55440

user output
192

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: 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