# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
854823 |
2023-09-29T04:14:07 Z |
NeroZein |
Tenis (COCI20_tenis) |
C++17 |
|
22 ms |
5404 KB |
#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> mn(n, n - 1);
vector<vector<int>> a(3, vector<int> (n));
vector<vector<int>> id(3, vector<int> (n));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < n; ++j) {
cin >> a[i][j];
--a[i][j];
id[i][a[i][j]] = j;
mn[a[i][j]] = min(mn[a[i][j]], j);
}
}
vector<int> suf(n);
for (int i = 0; i < n; ++i) {
suf[mn[i]]++;
}
for (int i = n - 2; i >= 0; --i) {
suf[i] += suf[i + 1];
}
vector<bool> vis(n);
vector<long long> c(3), p(n);
for (int j = 0; j < n; ++j) {
for (int i = 0; i < 3; ++i) {
if (vis[a[i][j]]) {
continue;
}
vis[a[i][j]] = true;
if (j < n - 1) {
c[i] += suf[j + 1];
p[a[i][j]] += suf[j + 1];
}
for (int k = i + 1; k < 3; ++k) {
if (vis[a[k][j]]) {
continue;
}
if (id[k][a[i][j]] < id[i][a[k][j]]) {
c[k]++;
p[a[k][j]]++;
} else {
c[i]++;
p[a[i][j]]++;
}
}
}
}
for (int i = 0; i < 3; ++i) {
cout << c[i] << " \n"[i == 2];
}
for (int i = 0; i < n; ++i) {
cout << p[i] << " \n"[i == n - 1];
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Partially correct |
0 ms |
348 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Partially correct |
0 ms |
348 KB |
Partially correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Partially correct |
0 ms |
348 KB |
Partially correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Partially correct |
15 ms |
2748 KB |
Partially correct |
6 |
Correct |
18 ms |
3952 KB |
Output is correct |
7 |
Incorrect |
22 ms |
5404 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |