Task: | Trade |
Sender: | z |
Submission time: | 2016-09-13 17:09:44 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | ACCEPTED | 0.05 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.05 s | details |
#9 | ACCEPTED | 0.05 s | details |
#10 | ACCEPTED | 0.05 s | details |
#11 | ACCEPTED | 0.06 s | details |
#12 | ACCEPTED | 0.05 s | details |
#13 | ACCEPTED | 0.05 s | details |
#14 | ACCEPTED | 0.05 s | details |
#15 | ACCEPTED | 0.05 s | details |
#16 | ACCEPTED | 0.05 s | details |
#17 | ACCEPTED | 0.05 s | details |
#18 | ACCEPTED | 0.05 s | details |
#19 | ACCEPTED | 0.05 s | details |
#20 | ACCEPTED | 0.05 s | details |
#21 | ACCEPTED | 0.09 s | details |
#22 | ACCEPTED | 0.05 s | details |
#23 | ACCEPTED | 0.06 s | details |
#24 | ACCEPTED | 0.05 s | details |
#25 | ACCEPTED | 0.05 s | details |
#26 | ACCEPTED | 0.05 s | details |
#27 | ACCEPTED | 0.05 s | details |
#28 | ACCEPTED | 0.06 s | details |
#29 | ACCEPTED | 0.05 s | details |
#30 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:25:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0; i<ag.size(); ++i){ ^ input/code.cpp:32:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (g+1<ag.size() && ag[g].first==ag[g+1].first) ++g; ^ input/code.cpp:18:7: warning: unused variable 'l' [-Wunused-variable] int l=0; ^
Code
#include <iostream> #include <vector> #include <algorithm> using namespace std; int n; int d[101]; vector<pair<int, int> > ag; int t[101][101]; int kk; int main(){ cin >> n; int l=0; for (int i=0; i<n; ++i){ cin >> d[i]; kk+=d[i]; ag.push_back(make_pair(-d[i], i)); } sort(ag.begin(), ag.end()); for (int i=0; i<ag.size(); ++i){ if (-ag[i].first*2>kk){ cout << "QAQ\n"; return 0; } while (ag[i].first){ int g=i+1; while (g+1<ag.size() && ag[g].first==ag[g+1].first) ++g; while (g>i && ag[i].first){ ++ag[g].first; ++ag[i].first; ++t[ag[i].second][ag[g].second]; ++t[ag[g].second][ag[i].second]; kk-=2; --g; } if (ag[i].first>0) break; } } for (int i=0; i<n; ++i){ for (int j=0; j<n; ++j) cout << t[i][j] << " "; cout << "\n"; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 78 16 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 2
Verdict: ACCEPTED
input |
---|
2 87 93 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 3
Verdict: ACCEPTED
input |
---|
2 63 29 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 4
Verdict: ACCEPTED
input |
---|
2 64 28 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 5
Verdict: ACCEPTED
input |
---|
1 74 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 6
Verdict: ACCEPTED
input |
---|
3 69 68 31 |
correct output |
---|
0 53 16 53 0 15 16 15 0 |
user output |
---|
0 53 16 53 0 15 16 15 0 |
Test 7
Verdict: ACCEPTED
input |
---|
3 63 24 69 |
correct output |
---|
0 9 54 9 0 15 54 15 0 |
user output |
---|
0 9 54 9 0 15 54 15 0 |
Test 8
Verdict: ACCEPTED
input |
---|
3 3 23 60 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 9
Verdict: ACCEPTED
input |
---|
1 94 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 10
Verdict: ACCEPTED
input |
---|
2 43 30 |
correct output |
---|
QAQ |
user output |
---|
QAQ |
Test 11
Verdict: ACCEPTED
input |
---|
74 22 20 85 38 99 25 16 71 14 27 ... |
correct output |
---|
0 9 2 0 0 0 0 0 0 0 0 0 0 0 0 ... |
user output |
---|
0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 ... |
Test 12
Verdict: ACCEPTED
input |
---|
66 90 45 20 41 30 32 18 98 72 82 ... |
correct output |
---|
0 20 0 0 0 0 0 16 0 0 0 0 0 0 ... |
user output |
---|
0 0 0 0 0 0 0 10 3 3 3 0 0 3 2... |
Test 13
Verdict: ACCEPTED
input |
---|
29 76 8 75 22 59 96 30 38 36 94 1... |
correct output |
---|
0 4 24 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 0 4 0 4 12 0 4 2 10 0 0 5 0 ... |
Test 14
Verdict: ACCEPTED
input |
---|
18 18 97 25 44 71 84 91 100 73 26... |
correct output |
---|
0 12 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 0 2 3 0 0 0 0 0 2 3 0 1 3 3 ... |
Test 15
Verdict: ACCEPTED
input |
---|
43 65 98 8 56 5 49 12 23 29 100 4... |
correct output |
---|
0 28 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 6 0 3 0 3 0 0 0 0 2 2 3 2 0 ... |
Test 16
Verdict: ACCEPTED
input |
---|
69 72 74 32 82 31 34 95 61 64 100... |
correct output |
---|
0 37 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 2 1 2 1 1 3 2 2 0 1 0 3 2 1 ... |
Test 17
Verdict: ACCEPTED
input |
---|
31 85 93 73 73 51 26 86 23 100 41... |
correct output |
---|
0 33 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 5 4 4 3 0 4 0 5 2 3 8 0 6 5 ... |
Test 18
Verdict: ACCEPTED
input |
---|
61 43 80 85 94 6 22 68 5 14 62 55... |
correct output |
---|
0 14 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 2 1 0 0 1 1 0 1 1 1 1 1 0 0 ... |
Test 19
Verdict: ACCEPTED
input |
---|
37 61 15 22 61 5 29 28 51 49 57 3... |
correct output |
---|
0 6 4 25 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 0 0 3 0 0 0 2 2 2 0 7 4 0 3 ... |
Test 20
Verdict: ACCEPTED
input |
---|
44 36 78 1 39 72 50 90 68 89 93 9... |
correct output |
---|
0 17 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 0 0 1 2 1 0 2 0 0 0 1 1 1 0 ... |
Test 21
Verdict: ACCEPTED
input |
---|
87 1 47 27 95 17 53 79 30 47 91 4... |
correct output |
---|
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
user output |
---|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Test 22
Verdict: ACCEPTED
input |
---|
63 83 91 93 92 58 16 22 58 75 92 ... |
correct output |
---|
0 48 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 3 5 4 3 0 0 3 2 3 2 2 0 0 0 ... |
Test 23
Verdict: ACCEPTED
input |
---|
15 90 69 94 19 6 83 23 83 18 31 9... |
correct output |
---|
0 37 8 0 0 0 0 0 0 0 0 0 0 0 4... |
user output |
---|
0 10 17 0 0 11 0 11 0 0 11 10 ... |
Test 24
Verdict: ACCEPTED
input |
---|
54 44 75 15 14 80 78 63 76 89 20 ... |
correct output |
---|
0 23 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 2 1 0 1 3 1 2 0 1 0 0 0 1 1 ... |
Test 25
Verdict: ACCEPTED
input |
---|
64 78 97 82 66 61 37 56 71 19 12 ... |
correct output |
---|
0 32 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 4 2 2 2 0 1 2 0 0 0 0 4 2 0 ... |
Test 26
Verdict: ACCEPTED
input |
---|
19 2 4 54 34 8 60 29 7 98 21 85 9... |
correct output |
---|
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
user output |
---|
0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 ... |
Test 27
Verdict: ACCEPTED
input |
---|
72 90 60 7 11 17 25 10 40 1 79 10... |
correct output |
---|
0 33 0 0 0 0 0 0 0 12 0 0 2 0 ... |
user output |
---|
0 2 0 0 0 0 0 0 0 3 0 0 3 0 0 ... |
Test 28
Verdict: ACCEPTED
input |
---|
64 61 83 12 86 87 86 31 91 84 15 ... |
correct output |
---|
0 32 0 0 0 0 0 0 0 0 0 0 0 0 0... |
user output |
---|
0 2 0 2 2 2 1 1 2 0 2 0 0 0 1 ... |
Test 29
Verdict: ACCEPTED
input |
---|
67 53 18 42 36 69 99 85 96 77 6 6... |
correct output |
---|
0 9 9 0 8 0 0 0 0 0 0 0 0 0 0 ... |
user output |
---|
0 1 0 1 2 0 2 0 2 0 1 1 1 1 0 ... |
Test 30
Verdict: ACCEPTED
input |
---|
57 91 42 71 53 66 12 70 18 62 84 ... |
correct output |
---|
0 18 11 0 0 0 0 0 0 5 0 0 0 0 ... |
user output |
---|
0 0 5 0 1 0 5 0 0 4 0 0 0 0 0 ... |