#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
500 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
500 ms |
528 KB |
Output is correct |
5 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |