# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
378916 |
2021-03-17T07:29:14 Z |
NONAME |
Tenis (COCI20_tenis) |
C++17 |
|
1000 ms |
2156 KB |
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int man = (int)(1e5 + 500);
int n;
int winPlayer[man], courts[man];
int a[3][man], loc[3][man];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for (int t = 0; t < 3; ++t) {
for (int i = 0; i < n; ++i) {
cin >> a[t][i];
--a[t][i];
loc[t][a[t][i]] = i;
}
}
cerr << "\n";
for (int i = 0; i < n; ++i) {
for (int j = (i + 1); j < n; ++j) {
int mnWin = n;
for (int t = 0; t < 3; ++t) {
mnWin = min(mnWin, min(loc[t][i], loc[t][j]));
}
int cnt = 0;
bool f1 = false, f2 = false;
for (int t = 0; t < 3; ++t) {
if (mnWin == loc[t][i]) {
f1 = true;
}
if (mnWin == loc[t][j]) {
f2 = true;
}
}
cnt = (f1 + f2);
if (cnt == 1) {
for (int t = 0; t < 3; ++t) {
if (mnWin == loc[t][i]) {
++winPlayer[i];
++courts[t];
break;
}
if (mnWin == loc[t][j]) {
++winPlayer[j];
++courts[t];
break;
}
}
} else {
int mnLose = n;
for (int t = 0; t < 3; ++t) {
if (mnWin == loc[t][i]) {
mnLose = min(mnLose, loc[t][j]);
}
if (mnWin == loc[t][j]) {
mnLose = min(mnLose, loc[t][i]);
}
}
int lst = -1;
cnt = 0;
f1 = false; f2 = false;
for (int t = 0; t < 3; ++t) {
if ((mnWin == loc[t][i]) && (mnLose == loc[t][j])) {
f1 = true;
if (lst == -1) {
lst = t;
}
}
if ((mnWin == loc[t][j]) && (mnLose == loc[t][i])) {
f2 = true;
if (lst == -1) {
lst = t;
}
}
}
assert(lst != -1); // assert
cnt = (f1 + f2);
if (cnt == 1) {
for (int t = 0; t < 3; ++t) {
if ((mnWin == loc[t][i]) && (mnLose == loc[t][j])) {
++courts[t];
++winPlayer[i];
break;
}
if ((mnWin == loc[t][j]) && (mnLose == loc[t][i])) {
++courts[t];
++winPlayer[j];
break;
}
}
} else {
++courts[lst];
if (loc[lst][i] == mnWin) {
++winPlayer[i];
} else {
++winPlayer[j];
}
}
}
}
}
for (int i = 0; i < 3; ++i) {
cout << courts[i] << " ";
}
cout << "\n";
for (int i = 0; i < n; ++i) {
cout << winPlayer[i] << " ";
}
cout << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Partially correct |
2 ms |
364 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Partially correct |
2 ms |
364 KB |
Partially correct |
4 |
Correct |
128 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Partially correct |
2 ms |
364 KB |
Partially correct |
4 |
Correct |
128 ms |
640 KB |
Output is correct |
5 |
Execution timed out |
1026 ms |
2156 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |