This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
typedef unsigned long long ull;
using namespace std;
const int N=3005;
int a[5][N],b[5][N],f[5],z[N],n;
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for (int i=1;i<=3;i++){
for (int j=1;j<=n;j++){
cin>>a[i][j];
b[i][a[i][j]]=j;
}
}
for (int i=1;i<=n;i++){
for (int j=i+1;j<=n;j++){
vector<int> v[3];
if (b[1][i]<b[1][j]) v[0]={b[1][i],b[1][j],1,i,j};
else v[0]={b[1][j],b[1][i],1,j,i};
if (b[2][i]<b[2][j]) v[1]={b[2][i],b[2][j],2,i,j};
else v[1]={b[2][j],b[2][i],2,j,i};
if (b[3][i]<b[3][j]) v[2]={b[3][i],b[3][j],3,i,j};
else v[2]={b[3][j],b[3][i],3,j,i};
sort(v,v+3);
f[v[0][2]]++;
z[v[0][3]]++;
}
}
for (int i=1;i<=3;i++) cout<<f[i]<<' ';
cout<<endl;
for (int i=1;i<=n;i++) cout<<z[i]<<' ';
cout<<endl;
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... |