This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define F first
#define S second
#define ALL(x) x.begin(), x.end()
#define MEM(x) memset(x, 0, sizeof(x))
#define MEMS(x) memset(x, -1, sizeof(x))
#define eb emplace_back
#define ep emplace
#define mkp make_pair
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*------------------------------------------------------------------*/
const int N = 1e5 + 5;
int a[3][N], win[N], cnt[3];
inline void solve() {
int n; cin >> n;
for(int i = 0; i < 3; ++i)
for(int j = 0; j < n; ++j) {
int tmp; cin >> tmp;
a[i][tmp - 1] = j;
}
for(int i = 0; i < n; ++i) {
for(int j = i + 1; j < n; ++j) {
array<int, 4> cur, tmp;
if(a[0][i] < a[0][j])
cur = {a[0][i], a[0][j], 0, i};
else
cur = {a[0][j], a[0][i], 0, j};
if(a[1][i] < a[1][j])
tmp = {a[1][i], a[1][j], 1, i};
else
tmp = {a[1][j], a[1][i], 1, j};
if(tmp < cur)
cur = tmp;
if(a[2][i] < a[2][j])
tmp = {a[2][i], a[2][j], 2, i};
else
tmp = {a[2][j], a[2][i], 2, j};
if(tmp < cur)
cur = tmp;
win[cur[3]]++;
cnt[cur[2]]++;
// cout << i << ' ' << j << '\n';
// cout << "?";
// for(int i = 0; i < 4; ++i)
// cout << cur[i] << " \n"[i == 3];
}
}
cout << cnt[0] << ' ' << cnt[1] << ' ' << cnt[2] << '\n';
for(int i = 0; i < n; ++i)
cout << win[i] << " \n"[i == n - 1];
}
int main() {
cin.tie(0), ios::sync_with_stdio(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |