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>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
const int N = 4000;
int n, arr[N][3], ans[N];
int main(){
cin.tie(0); ios::sync_with_stdio(0);
cin >> n;
for(int i = 0; i < 3; i++){
for(int j = 1; j <= n; j++){
int a;
cin >> a;
ans[j] = 0;
arr[a][i] = j;
}
}
// cout << '\n';
// for(int i = 0; i < 3; i++){
// for(int j = 1; j <= n; j++){
// cout << arr[j][i] << ' ';
// }
// cout << '\n';
// }
vector<int> anss(3);
for(int i = 1; i <= n; i++) ans[i] = 0;
for(int i = 1; i <= n; i++){
for(int j = i + 1; j <= n; j++){
// cout << i << ' ' << j << ' ';
vector<pair<int, int>> a;
vector<pair<int, int>> b;
for(int k = 0; k < 3; k++) a.pb({arr[i][k], k});
for(int k = 0; k < 3; k++) b.pb({arr[j][k], k});
sort(all(a));
sort(all(b));
if(a[0].first > b[0].first){
ans[j]++;
anss[b[0].second]++;
}else if(b[0].first > a[0].first){
ans[i]++;
anss[a[0].second]++;
}else{
if(a[b[0].second] > b[a[0].second]) ans[i]++, anss[a[0].second]++;
else ans[j]++, anss[b[0].second]++;
}
}
}
cout << '\n';
cout << anss[0] << ' ' << anss[1] << ' ' << anss[2] << '\n';
for(int i = 0; i < n; i++) cout << ans[i+1] << ' ';
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... |