Task: | Candies |
Sender: | Pietari Kaskela |
Submission time: | 2015-09-09 18:48:31 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.05 s | details |
#3 | WRONG ANSWER | 0.05 s | details |
#4 | WRONG ANSWER | 0.05 s | details |
#5 | WRONG ANSWER | 0.05 s | details |
#6 | ACCEPTED | 0.05 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | WRONG ANSWER | 0.07 s | details |
#9 | WRONG ANSWER | 0.05 s | details |
#10 | WRONG ANSWER | 0.07 s | details |
#11 | WRONG ANSWER | 0.09 s | details |
#12 | WRONG ANSWER | 0.07 s | details |
#13 | WRONG ANSWER | 0.07 s | details |
#14 | WRONG ANSWER | 0.08 s | details |
#15 | WRONG ANSWER | 0.08 s | details |
#16 | WRONG ANSWER | 0.10 s | details |
#17 | WRONG ANSWER | 0.10 s | details |
#18 | WRONG ANSWER | 0.08 s | details |
#19 | ACCEPTED | 0.08 s | details |
#20 | ACCEPTED | 0.08 s | details |
#21 | ACCEPTED | 0.06 s | details |
Code
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pll pair<long long, long long> #define defmod 1000000007 using namespace std; int main(){ int n; cin >> n; int c[101010]; ll y = 0; for(int i = 0; i < n; i++){ cin >> c[i+1]; y+=c[i+1]; } if(y%2){ cout << "QAQ" << endl; return 0; } ll m1 = 0, m2 = 0; for(int i = 1; i <= n/2; i++){ if(c[i]-c[i+n/2] < 0) m2+=-(c[i]-c[i+n/2]); else m1+=c[i]-c[i+n/2]; } cout << max(m1, m2) << endl; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
8
4 5 1 7 0 0 3 4 |
correct output |
---|
12 |
user output |
---|
12 |
Test 2
Verdict: ACCEPTED
input |
---|
6
1 2 3 1 1 1 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 3
Verdict: WRONG ANSWER
input |
---|
8
0 5 0 9 5 1 5 3 |
correct output |
---|
12 |
user output |
---|
10 |
Test 4
Verdict: WRONG ANSWER
input |
---|
2
1 9 |
correct output |
---|
4 |
user output |
---|
8 |
Test 5
Verdict: WRONG ANSWER
input |
---|
10
1 3 10 3 6 9 4 10 1 5 |
correct output |
---|
24 |
user output |
---|
9 |
Test 6
Verdict: ACCEPTED
input |
---|
4
7 9 3 4 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 7
Verdict: ACCEPTED
input |
---|
12
0 2 6 10 8 6 3 2 8 3 6 7 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 8
Verdict: WRONG ANSWER
input |
---|
60742
4710 1910 1659 9225 7381 3865 ... |
correct output |
---|
6017952277 |
user output |
---|
51016617 |
Test 9
Verdict: WRONG ANSWER
input |
---|
11584
5282 4860 4143 2150 2812 601 3... |
correct output |
---|
965732716 |
user output |
---|
9770998 |
Test 10
Verdict: WRONG ANSWER
input |
---|
60404
2628 7729 9173 3502 2111 1040 ... |
correct output |
---|
10665547149 |
user output |
---|
50377386 |
Test 11
Verdict: WRONG ANSWER
input |
---|
93500
643743466 254334505 56338701 6... |
correct output |
---|
2332675821421250 |
user output |
---|
7927622292034 |
Test 12
Verdict: WRONG ANSWER
input |
---|
88320
980662112 130626205 836179288 ... |
correct output |
---|
852335249751381 |
user output |
---|
7484700364724 |
Test 13
Verdict: WRONG ANSWER
input |
---|
86084
661623466 605516853 815285452 ... |
correct output |
---|
1780767548661907 |
user output |
---|
7351150350606 |
Test 14
Verdict: WRONG ANSWER
input |
---|
100000
683931982 877847097 963735593 ... |
correct output |
---|
2439312588016943 |
user output |
---|
8467252320749 |
Test 15
Verdict: WRONG ANSWER
input |
---|
100000
607939901 388494871 946955020 ... |
correct output |
---|
2078642477260774 |
user output |
---|
8456586726001 |
Test 16
Verdict: WRONG ANSWER
input |
---|
100000
129999770 281887896 212654534 ... |
correct output |
---|
1634491104792725 |
user output |
---|
8463664466088 |
Test 17
Verdict: WRONG ANSWER
input |
---|
100000
984587506 859617842 965313525 ... |
correct output |
---|
908083215653911 |
user output |
---|
8498107015661 |
Test 18
Verdict: WRONG ANSWER
input |
---|
100000
262098859 130542442 982092757 ... |
correct output |
---|
2404890264763254 |
user output |
---|
8479566778285 |
Test 19
Verdict: ACCEPTED
input |
---|
94478
586981276 778806053 845074693 ... |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 20
Verdict: ACCEPTED
input |
---|
82474
989366273 218860004 500508088 ... |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 21
Verdict: ACCEPTED
input |
---|
8
1 1 7 2 1 1 7 2 |
correct output |
---|
0 |
user output |
---|
0 |