#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();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
65 ms |
408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
65 ms |
408 KB |
Output is correct |
5 |
Execution timed out |
1084 ms |
1572 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |