제출 #575897

#제출 시각아이디문제언어결과실행 시간메모리
575897eecsTenis (COCI20_tenis)C++17
50 / 110
1080 ms2048 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n, p[3][maxn], q[3][maxn], ans[maxn]; long long cnt[3]; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 0; i < 3; i++) { for (int j = 1; j <= n; j++) { cin >> p[i][j], q[i][p[i][j]] = j; } } for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { array<int, 3> res{INT_MAX, 0, 0}; for (int k = 0; k < 3; k++) { int x = q[k][i], y = q[k][j]; res = min(res, array<int, 3>{min(x, y), max(x, y), k}); } (q[res[2]][i] < q[res[2]][j] ? ans[i] : ans[j])++, cnt[res[2]]++; } } cout << cnt[0] << " " << cnt[1] << " " << cnt[2] << "\n"; for (int i = 1; i <= n; i++) { cout << ans[i] << " "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...