CSES - Leirikisa 6.3.2017 - Results
Submission details
Task:Lista
Sender:ankka22
Submission time:2017-03-06 16:20:42 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.04 s1details
#20.04 s1details
#30.04 s1details
#40.04 s1details
#50.04 s1details
#60.04 s1details
#70.04 s1details
#80.04 s1details
#90.03 s1details
#100.04 s1details
#110.07 s2details
#120.09 s2details
#130.10 s2details
#140.14 s2details
#150.10 s2details
#160.09 s2details
#170.10 s2details
#180.10 s2details
#190.10 s2details
#200.12 s2details

Code

#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
long n, o, p, k;
vector<long> v;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p;
		o += p;
		v.push_back(p);
	}
	sort(v.begin(), v.end());
	for (int i = 1; i <= n-1; i++) {
		k += o;
		o -= v.back();
		v.pop_back();
	}
	cout << k << " " << endl;
}

Test details

Test 1

Group: 1

Verdict:

input
100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
0

user output
5049 

Test 2

Group: 1

Verdict:

input
100
100 100 100 100 100 100 100 10...

correct output
0

user output
504900 

Test 3

Group: 1

Verdict:

input
100
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
99

user output
171699 

Test 4

Group: 1

Verdict:

input
100
87 26 53 26 74 50 42 59 36 97 ...

correct output
7

user output
188054 

Test 5

Group: 1

Verdict:

input
100
8 13 46 3 85 40 62 70 14 29 88...

correct output
2

user output
133555 

Test 6

Group: 1

Verdict:

input
100
33 30 73 66 8 42 68 41 56 26 3...

correct output
6

user output
160093 

Test 7

Group: 1

Verdict:

input
100
16 41 11 93 19 59 1 35 1 79 45...

correct output
18

user output
158354 

Test 8

Group: 1

Verdict:

input
100
32 5 78 9 53 6 23 99 98 38 29 ...

correct output
11

user output
163524 

Test 9

Group: 1

Verdict:

input
100
70 43 99 91 87 5 26 33 3 97 60...

correct output
11

user output
150197 

Test 10

Group: 1

Verdict:

input
100
80 15 67 8 19 2 47 2 51 79 34 ...

correct output
23

user output
162818 

Test 11

Group: 2

Verdict:

input
100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
0

user output
5000049999 

Test 12

Group: 2

Verdict:

input
100000
1000000000 1000000000 10000000...

correct output
0

user output
5000049999000000000 

Test 13

Group: 2

Verdict:

input
100000
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
99999

user output
166671666699999 

Test 14

Group: 2

Verdict:

input
100000
368557660 202067774 869767532 ...

correct output
45422

user output
1675613806937748139 

Test 15

Group: 2

Verdict:

input
100000
279796163 249838695 918802148 ...

correct output
58055

user output
1670803970121385234 

Test 16

Group: 2

Verdict:

input
100000
652215128 684591779 146182625 ...

correct output
30508

user output
1667876835469908051 

Test 17

Group: 2

Verdict:

input
100000
912992845 719581379 126326667 ...

correct output
54978

user output
1669740815087158812 

Test 18

Group: 2

Verdict:

input
100000
974161548 952419593 431337025 ...

correct output
1637

user output
1666941010249491699 

Test 19

Group: 2

Verdict:

input
100000
912344935 691159511 836812179 ...

correct output
57759

user output
1664841191348162256 

Test 20

Group: 2

Verdict:

input
100000
752551555 857180406 698838947 ...

correct output
18067

user output
1672150455980561828