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

Code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MN = 2e6+100;
int t[MN];
int main() {
    ll n;
    cin>>n;
    for(ll i = 0; i < n; ++i) {
	int x;
	cin>>x;
	++t[x];
    }
    ll ans = 0;
    for(ll i = 1; i < MN; ++i) {
	ll q = 0;
	ll w = 0;
	for(ll j = 1; j*i < MN; ++j) {
	    q += t[j*i]*i;
	    w += t[j*i];
	}
	if(w >= 2) {
	    ans = max(ans, q);
	}
    }
    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: 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