Submission #399308

# Submission time Handle Problem Language Result Execution time Memory
399308 2021-05-05T14:44:46 Z retsiger Tenis (COCI20_tenis) C++14
50 / 110
1000 ms 2024 KB
#include<bits/stdc++.h>
#define bug(x) cerr<<#x<<" = "<<x<<'\n'

using namespace std;

const int maxn = 100100;

int N, A[3][maxn], loc[maxn][3];
int cn[3], pt[maxn];

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
//  freopen("cc.inp", "r", stdin);
//  freopen("cc.out", "w", stdout);
  cin >> N;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> A[i][j];
      loc[A[i][j]][i] = j;
    }
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      vector<array<int, 3>> v;
      for (int t = 0; t < 3; ++t) {
        int x = min(loc[i][t], loc[j][t]);
        int y = max(loc[i][t], loc[j][t]);
        v.push_back({x, y, t});
      }
      sort(v.begin(), v.end());
      auto p = v[0];
      if (p[0] == loc[i][p[2]]) pt[i]++;
      else pt[j]++;
      cn[p[2]]++;
    }
  }
  for (int i = 0; i < 3; ++i) cout << cn[i] << ' ';
  cout << '\n';
  for (int i = 1; i <= N; ++i) cout << pt[i] << ' ';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 8 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 8 ms 332 KB Output is correct
4 Correct 673 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 8 ms 332 KB Output is correct
4 Correct 673 ms 468 KB Output is correct
5 Execution timed out 1085 ms 2024 KB Time limit exceeded
6 Halted 0 ms 0 KB -