This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
____ ____ ____ ____ ____
||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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |