Submission #366440

#TimeUsernameProblemLanguageResultExecution timeMemory
366440VEGAnnTenis (COCI20_tenis)C++14
50 / 110
1082 ms2156 KiB
#include <bits/stdc++.h> #define i2 array<int,2> using namespace std; const int N = 100100; const int oo = 2e9; int a[3][N], n, win[N], crt[3], loc[3][N]; void calc(int x, int y){ i2 mn = {oo, oo}; for (int j = 0; j < 3; j++) mn = min(mn, {min(loc[j][x], loc[j][y]), max(loc[j][x], loc[j][y])}); for (int j = 0; j < 3; j++) { i2 cr = {min(loc[j][x], loc[j][y]), max(loc[j][x], loc[j][y])}; if (mn == cr){ if (loc[j][x] > loc[j][y]) swap(x, y); win[x]++; crt[j]++; return; } } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL cin >> n; for (int j = 0; j < 3; j++) for (int i = 1; i <= n; i++) { cin >> a[j][i]; loc[j][a[j][i]] = i; } for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) calc(i, j); for (int i = 0; i < 3; i++) cout << crt[i] << " "; cout << '\n'; for (int i = 1; i <= n; i++) cout << win[i] << " "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...