Task: | Trade |
Sender: | trukilla hissikuiluun |
Submission time: | 2016-09-13 18:53:38 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.05 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.05 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | WRONG ANSWER | 0.05 s | details |
#7 | WRONG ANSWER | 0.06 s | details |
#8 | ACCEPTED | 0.06 s | details |
#9 | ACCEPTED | 0.05 s | details |
#10 | ACCEPTED | 0.05 s | details |
#11 | WRONG ANSWER | 0.05 s | details |
#12 | WRONG ANSWER | 0.06 s | details |
#13 | WRONG ANSWER | 0.06 s | details |
#14 | WRONG ANSWER | 0.05 s | details |
#15 | WRONG ANSWER | 0.05 s | details |
#16 | WRONG ANSWER | 0.05 s | details |
#17 | WRONG ANSWER | 0.05 s | details |
#18 | WRONG ANSWER | 0.06 s | details |
#19 | WRONG ANSWER | 0.05 s | details |
#20 | WRONG ANSWER | 0.06 s | details |
#21 | WRONG ANSWER | 0.05 s | details |
#22 | WRONG ANSWER | 0.05 s | details |
#23 | WRONG ANSWER | 0.05 s | details |
#24 | WRONG ANSWER | 0.05 s | details |
#25 | WRONG ANSWER | 0.06 s | details |
#26 | WRONG ANSWER | 0.05 s | details |
#27 | WRONG ANSWER | 0.05 s | details |
#28 | WRONG ANSWER | 0.05 s | details |
#29 | WRONG ANSWER | 0.06 s | details |
#30 | WRONG ANSWER | 0.06 s | details |
Code
#include <iostream> using namespace std; pair<int,int> d[101]; int ans[101][101]; //bool comp(const pair<int,int> &a, const pair<int,int> &b) //{ // return a.second > b.second; //} int main() { int n; cin >> n; int cities[n]; for (int i = 0; i < n; i++) { int cur; cin >> cur; cities[i] = cur; } int agreements[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { agreements[i][j] = 0; } } bool fail = false; for (int i = n - 1; i >= 0; i--) { for (int j = 0; j < i; j++) { if (j == i) { break; } if (cities[i] > cities[j]) { agreements[i][j] = cities[j]; agreements[j][i] = cities[j]; cities[i] = cities[i] - cities[j]; cities[j] = 0; continue; } else if (cities[i] == cities[j]) { agreements[i][j] = cities[j]; agreements[j][i] = cities[j]; cities[j] = 0; cities[i] = 0; break; } else { agreements[i][j] = cities[i]; agreements[j][i] = cities[i]; cities[j] -= cities[i]; cities[i] = 0; break; } } if (cities[i] > 0) { // cout << "fails because "; // cout << cities[i]; fail = true; break; } } if (fail) { cout << "QAQ\n"; } else { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cout << agreements[i][j]; } cout << "\n"; } } return 0; // cin.sync_with_stdio(0); // int n; // cin >> n; // // int sum1 = 0; // for (int i = 0; i < n; ++i) // { // int a; // cin >> a; // d[i] = make_pair(i,a); // sum1 += d[i].second; // } // sort(d.begin(), d.end(), comp); // int sum2 = 0; // for (int i = 0; i < n; ++i) // { // if (d[i]==0) continue; // for (int j = i+1; j < n && d[i] > 0; ++j) // { // int can = 0; // if (d[j] < d[i]) // { // can = d[j]; // } // else // { // can = d[i]; // } // d[j] -= can; // d[i] -= can; // ans[i][j] = ans[j][i] = can; // sum2 += can; // } // } // cout << sum1 << " " << sum2 << endl; // if (sum1 != sum2) // { // cout << "QAQ" << endl; // } // else // { // for (int i = 0; i < n; ++i) // { // for (int j = 0; j < n; ++j) // { // cout << ans[i][j] << " "; // } // cout << endl; // } // } return 0; }
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: WRONG ANSWER
input |
---|
3 69 68 31 |
correct output |
---|
0 53 16 53 0 15 16 15 0 |
user output |
---|
QAQ |
Test 7
Verdict: WRONG ANSWER
input |
---|
3 63 24 69 |
correct output |
---|
0 9 54 9 0 15 54 15 0 |
user output |
---|
QAQ |
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: WRONG ANSWER
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 |
---|
QAQ |
Test 12
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 13
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 14
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 15
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 16
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 17
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 18
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 19
Verdict: WRONG ANSWER
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 |
---|
000000000000000000000000000000... |
Test 20
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 21
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 22
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 23
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 24
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 25
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 26
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 27
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 28
Verdict: WRONG ANSWER
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 |
---|
000000000000000000000000000000... |
Test 29
Verdict: WRONG ANSWER
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 |
---|
QAQ |
Test 30
Verdict: WRONG ANSWER
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 |
---|
QAQ |