/**
____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N_MAX = 100002;
int n;
int a[N_MAX], b[N_MAX], c[N_MAX];
int apos[N_MAX], bpos[N_MAX], cpos[N_MAX];
int f (int x, int y)
{
if(x > y)
swap(x, y);
return x * n + y;
}
int cnta, cntb, cntc;
int wins[N_MAX];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
apos[a[i]] = i;
}
for(int i = 1; i <= n; i++)
{
cin >> b[i];
bpos[b[i]] = i;
}
for(int i = 1; i <= n; i++)
{
cin >> c[i];
cpos[c[i]] = i;
}
for(int i = 1; i <= n; i++)
for(int j = i + 1; j <= n; j++)
{
int fa = f(apos[i], apos[j]);
int fb = f(bpos[i], bpos[j]);
int fc = f(cpos[i], cpos[j]);
int mi = min({fa, fb, fc});
if(fa == mi)
{
cnta++;
if(apos[i] < apos[j])
wins[i]++;
else
wins[j]++;
}
else if(fb == mi)
{
cntb++;
if(bpos[i] < bpos[j])
wins[i]++;
else
wins[j]++;
}
else
{
cntc++;
if(cpos[i] < cpos[j])
wins[i]++;
else
wins[j]++;
}
}
cout << cnta << " " << cntb << " " << cntc << "\n";
for(int i = 1; i <= n; i++)
cout << wins[i] << " ";
cout << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
72 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
72 ms |
640 KB |
Output is correct |
5 |
Execution timed out |
1094 ms |
2156 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |