Submission #387467

# Submission time Handle Problem Language Result Execution time Memory
387467 2021-04-08T12:58:28 Z rama_pang IOI Fever (JOI21_fever) C++17
100 / 100
3935 ms 83980 KB
#include <bits/stdc++.h>
using namespace std;

using lint = long long;
const lint inf = 1e18;

// By case analysis, if we determine the direction
// of person 1, then all other persons have a
// unique direction in order to possibly intersect.
//
// Proof:
// Assume person 1 is at (0, 0), and goes to positive X.
// At time t, can infect at most t units away from (0, 0)
// in Manhattan distance.
//
// If there is a person at (X, Y) at quadrant 1:
// If X > Y: this person must go left, otherwise never hit
// Manhattan bounding box at any time t.
// If X < Y: this person must go down, otherwise never hit
// Manhattan bounding box at any time t.
// If X = Y: this person must go down (if person 1 goes right),
// otherwise never hit Manhattan bounding box at any time t.
//
// Case analysis is the same for all other quadrants.
//
// Fix the direction of person 1. Then, we can count all possible
// intersections by processing the persons' intersections in order.
// We can create 9N nodes: 1 for shortest time to get there, and 8
// for every possible direction. Then, we can run Dijkstra from
// person 1. Take care, that from the original shortest time node,
// we can only go to a node if the distance >= shortest_distance[u].
//
// Time complexity: O(N log N).

const vector<pair<int, int>> dxy = {
  {2, 0}, {1, 1}, {0, 2}, {-1, 1}, {-2, 0}, {-1, -1}, {0, -2}, {1, -1}
};

int Solve(int N, vector<int> X, vector<int> Y, vector<int> D) {
  map<pair<lint, lint>, int> idx;
  vector<array<lint, 5>> ls;

  for (int i = 0; i < N; i++) {
    idx[{X[i], Y[i]}] = i;

    ls.push_back({4, 0, Y[i] + Y[i], X[i], Y[i]});
    ls.push_back({4, 1, X[i] + X[i], X[i], Y[i]});
    ls.push_back({4, 2, X[i] + Y[i], X[i], Y[i]});
    ls.push_back({4, 3, X[i] - Y[i], X[i], Y[i]});

    ls.push_back({D[i] / 2, 0, Y[i] + Y[i], X[i], Y[i]});
    ls.push_back({D[i] / 2, 1, X[i] + X[i], X[i], Y[i]});
    ls.push_back({D[i] / 2, 2, X[i] + Y[i], X[i], Y[i]});
    ls.push_back({D[i] / 2, 3, X[i] - Y[i], X[i], Y[i]});
  }

  sort(begin(ls), end(ls));

  const auto GetNext = [&](lint x, lint y, int dir, int ndir = 4) -> int {
    if (dir == 0) {
      const array<lint, 5> t = {ndir, 0, y + y, x, y};
      auto it = lower_bound(begin(ls), end(ls), t);
      if (it == end(ls) || (*it)[0] != t[0] || (*it)[1] != t[1] || (*it)[2] != t[2]) return -1;
      return idx[{(*it)[3], (*it)[4]}];
    }
    if (dir == 1) {
      const array<lint, 5> t = {ndir, 3, x - y, x, y};
      auto it = lower_bound(begin(ls), end(ls), t);
      if (it == end(ls) || (*it)[0] != t[0] || (*it)[1] != t[1] || (*it)[2] != t[2]) return -1;
      return idx[{(*it)[3], (*it)[4]}];
    }
    if (dir == 2) {
      const array<lint, 5> t = {ndir, 1, x + x, x, y};
      auto it = lower_bound(begin(ls), end(ls), t);
      if (it == end(ls) || (*it)[0] != t[0] || (*it)[1] != t[1] || (*it)[2] != t[2]) return -1;
      return idx[{(*it)[3], (*it)[4]}];
    }
    if (dir == 3) {
      const array<lint, 5> t = {ndir, 2, x + y, x, y};
      auto it = upper_bound(begin(ls), end(ls), t);
      if (it == begin(ls) || (*prev(it))[0] != t[0] || (*prev(it))[1] != t[1] || (*prev(it))[2] != t[2]) return -1;
      return idx[{(*prev(it))[3], (*prev(it))[4]}];
    }
    if (dir == 4) {
      const array<lint, 5> t = {ndir, 0, y + y, x, y};
      auto it = upper_bound(begin(ls), end(ls), t);
      if (it == begin(ls) || (*prev(it))[0] != t[0] || (*prev(it))[1] != t[1] || (*prev(it))[2] != t[2]) return -1;
      return idx[{(*prev(it))[3], (*prev(it))[4]}];
    }
    if (dir == 5) {
      const array<lint, 5> t = {ndir, 3, x - y, x, y};
      auto it = upper_bound(begin(ls), end(ls), t);
      if (it == begin(ls) || (*prev(it))[0] != t[0] || (*prev(it))[1] != t[1] || (*prev(it))[2] != t[2]) return -1;
      return idx[{(*prev(it))[3], (*prev(it))[4]}];
    }
    if (dir == 6) {
      const array<lint, 5> t = {ndir, 1, x + x, x, y};
      auto it = upper_bound(begin(ls), end(ls), t);
      if (it == begin(ls) || (*prev(it))[0] != t[0] || (*prev(it))[1] != t[1] || (*prev(it))[2] != t[2]) return -1;
      return idx[{(*prev(it))[3], (*prev(it))[4]}];
    }
    if (dir == 7) {
      const array<lint, 5> t = {ndir, 2, x + y, x, y};
      auto it = lower_bound(begin(ls), end(ls), t);
      if (it == end(ls) || (*it)[0] != t[0] || (*it)[1] != t[1] || (*it)[2] != t[2]) return -1;
      return idx[{(*it)[3], (*it)[4]}];
    }
  };

  vector<lint> dist(9 * N, inf);
  priority_queue<pair<lint, int>, vector<pair<lint, int>>, greater<pair<lint, int>>> pq;

  const auto Relax = [&](int u, int dir, lint d) {
    if (dist[N * dir + u] > d) {
      dist[N * dir + u] = d;
      pq.emplace(dist[N * dir + u], N * dir + u);
    }
  };

  Relax(0, 8, 0);
  while (!pq.empty()) {
    int u = pq.top().second % N;
    int di = pq.top().second / N;
    lint dt = pq.top().first;
    pq.pop();
    if (dist[N * di + u] != dt) {
      continue;
    }
    Relax(u, 8, dt);
    if (di == 8) {
      if (D[u] == 0) {
        if (int dir = 7, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 1); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 0, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 2); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 1, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 3); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
      }
      if (D[u] == 2) {
        if (int dir = 1, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 2); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 2, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 3); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 3, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 0); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
      }
      if (D[u] == 4) {
        if (int dir = 3, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 3); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 4, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 0); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 5, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 1); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
      }
      if (D[u] == 6) {
        if (int dir = 5, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 0); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 6, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 1); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
        if (int dir = 7, v = GetNext(X[u] + dxy[dir].first * dt, Y[u] + dxy[dir].second * dt, dir, 2); v != -1) {
          Relax(v, dir, (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
        }
      }
    } else {
      if (int dir = di, v = GetNext(X[u] + dxy[dir].first, Y[u] + dxy[dir].second, dir); v != -1) {
        Relax(v, dir, dt + (abs(X[u] - X[v]) + abs(Y[u] - Y[v])) / 2);
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += dist[N * 8 + i] != inf;
  }
  return ans;
}

vector<int> Direction(int N, vector<int> X, vector<int> Y) {
  vector<int> D(N);
  D[0] = 0;
  for (int i = 1; i < N; i++) {
    if (abs(X[i]) == abs(Y[i])) {
      if (X[i] > 0 && Y[i] > 0) {
        D[i] = 6;
      } else if (X[i] > 0 && Y[i] < 0) {
        D[i] = 2;
      } else {
        D[i] = 0;
      }
    } else {
      if (X[i] >= 0 && Y[i] >= 0) {
        if (abs(X[i]) > abs(Y[i])) {
          D[i] = 4;
        } else {
          D[i] = 6;
        }
      } else if (X[i] <= 0 && Y[i] >= 0) {
        if (abs(X[i]) > abs(Y[i])) {
          D[i] = 0;
        } else {
          D[i] = 6;
        }
      } else if (X[i] <= 0 && Y[i] <= 0) {
        if (abs(X[i]) > abs(Y[i])) {
          D[i] = 0;
        } else {
          D[i] = 2;
        }
      } else if (X[i] >= 0 && Y[i] <= 0) {
        if (abs(X[i]) > abs(Y[i])) {
          D[i] = 4;
        } else {
          D[i] = 2;
        }
      }
    }
  }

  return D;
}

int main() {
  auto start = clock();

  ios::sync_with_stdio(0);
  cin.tie(0);

  int N;
  cin >> N;

  vector<int> X(N), Y(N);
  for (int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i];
    X[i] *= 2; Y[i] *= 2;
  }

  for (int i = N - 1; i >= 0; i--) { // Initial person at (0, 0)
    X[i] -= X[0];
    Y[i] -= Y[0];
  }

  int ans = 0;
  for (int d = 0; d < 4; d++) {
    ans = max(ans, Solve(N, X, Y, Direction(N, X, Y)));
    for (int i = 0; i < N; i++) {
      tie(X[i], Y[i]) = pair(-Y[i], X[i]);
    }
  }

  cout << ans << '\n';
  return 0;
}

Compilation message

fever.cpp: In function 'int main()':
fever.cpp:234:8: warning: unused variable 'start' [-Wunused-variable]
  234 |   auto start = clock();
      |        ^~~~~
fever.cpp: In lambda function:
fever.cpp:108:3: warning: control reaches end of non-void function [-Wreturn-type]
  108 |   };
      |   ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 236 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 236 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 236 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 2 ms 364 KB Output is correct
47 Correct 1 ms 364 KB Output is correct
48 Correct 2 ms 364 KB Output is correct
49 Correct 2 ms 364 KB Output is correct
50 Correct 2 ms 364 KB Output is correct
51 Correct 2 ms 364 KB Output is correct
52 Correct 2 ms 364 KB Output is correct
53 Correct 2 ms 364 KB Output is correct
54 Correct 2 ms 364 KB Output is correct
55 Correct 2 ms 364 KB Output is correct
56 Correct 2 ms 364 KB Output is correct
57 Correct 2 ms 364 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 364 KB Output is correct
60 Correct 2 ms 364 KB Output is correct
61 Correct 2 ms 364 KB Output is correct
62 Correct 2 ms 364 KB Output is correct
63 Correct 2 ms 364 KB Output is correct
64 Correct 2 ms 364 KB Output is correct
65 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 236 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 2 ms 364 KB Output is correct
47 Correct 1 ms 364 KB Output is correct
48 Correct 2 ms 364 KB Output is correct
49 Correct 2 ms 364 KB Output is correct
50 Correct 2 ms 364 KB Output is correct
51 Correct 2 ms 364 KB Output is correct
52 Correct 2 ms 364 KB Output is correct
53 Correct 2 ms 364 KB Output is correct
54 Correct 2 ms 364 KB Output is correct
55 Correct 2 ms 364 KB Output is correct
56 Correct 2 ms 364 KB Output is correct
57 Correct 2 ms 364 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 364 KB Output is correct
60 Correct 2 ms 364 KB Output is correct
61 Correct 2 ms 364 KB Output is correct
62 Correct 2 ms 364 KB Output is correct
63 Correct 2 ms 364 KB Output is correct
64 Correct 2 ms 364 KB Output is correct
65 Correct 2 ms 364 KB Output is correct
66 Correct 21 ms 2884 KB Output is correct
67 Correct 21 ms 2884 KB Output is correct
68 Correct 21 ms 2884 KB Output is correct
69 Correct 52 ms 2884 KB Output is correct
70 Correct 31 ms 3012 KB Output is correct
71 Correct 25 ms 2884 KB Output is correct
72 Correct 22 ms 2884 KB Output is correct
73 Correct 21 ms 2884 KB Output is correct
74 Correct 23 ms 2884 KB Output is correct
75 Correct 27 ms 2884 KB Output is correct
76 Correct 23 ms 2884 KB Output is correct
77 Correct 23 ms 2884 KB Output is correct
78 Correct 22 ms 2904 KB Output is correct
79 Correct 23 ms 2884 KB Output is correct
80 Correct 22 ms 3012 KB Output is correct
81 Correct 23 ms 2884 KB Output is correct
82 Correct 24 ms 2884 KB Output is correct
83 Correct 24 ms 2884 KB Output is correct
84 Correct 21 ms 2756 KB Output is correct
85 Correct 23 ms 2756 KB Output is correct
86 Correct 24 ms 2756 KB Output is correct
87 Correct 21 ms 2884 KB Output is correct
88 Correct 23 ms 2756 KB Output is correct
89 Correct 24 ms 2884 KB Output is correct
90 Correct 25 ms 2884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 236 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 2 ms 364 KB Output is correct
47 Correct 1 ms 364 KB Output is correct
48 Correct 2 ms 364 KB Output is correct
49 Correct 2 ms 364 KB Output is correct
50 Correct 2 ms 364 KB Output is correct
51 Correct 2 ms 364 KB Output is correct
52 Correct 2 ms 364 KB Output is correct
53 Correct 2 ms 364 KB Output is correct
54 Correct 2 ms 364 KB Output is correct
55 Correct 2 ms 364 KB Output is correct
56 Correct 2 ms 364 KB Output is correct
57 Correct 2 ms 364 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 364 KB Output is correct
60 Correct 2 ms 364 KB Output is correct
61 Correct 2 ms 364 KB Output is correct
62 Correct 2 ms 364 KB Output is correct
63 Correct 2 ms 364 KB Output is correct
64 Correct 2 ms 364 KB Output is correct
65 Correct 2 ms 364 KB Output is correct
66 Correct 805 ms 72848 KB Output is correct
67 Correct 991 ms 81960 KB Output is correct
68 Correct 1008 ms 82036 KB Output is correct
69 Correct 1188 ms 82084 KB Output is correct
70 Correct 1363 ms 83952 KB Output is correct
71 Correct 1004 ms 83800 KB Output is correct
72 Correct 1008 ms 83552 KB Output is correct
73 Correct 1081 ms 83944 KB Output is correct
74 Correct 1002 ms 83684 KB Output is correct
75 Correct 1018 ms 83816 KB Output is correct
76 Correct 1137 ms 83792 KB Output is correct
77 Correct 1016 ms 83980 KB Output is correct
78 Correct 1191 ms 83684 KB Output is correct
79 Correct 1177 ms 83768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 236 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 1 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 1 ms 364 KB Output is correct
42 Correct 1 ms 364 KB Output is correct
43 Correct 1 ms 364 KB Output is correct
44 Correct 1 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 2 ms 364 KB Output is correct
47 Correct 1 ms 364 KB Output is correct
48 Correct 2 ms 364 KB Output is correct
49 Correct 2 ms 364 KB Output is correct
50 Correct 2 ms 364 KB Output is correct
51 Correct 2 ms 364 KB Output is correct
52 Correct 2 ms 364 KB Output is correct
53 Correct 2 ms 364 KB Output is correct
54 Correct 2 ms 364 KB Output is correct
55 Correct 2 ms 364 KB Output is correct
56 Correct 2 ms 364 KB Output is correct
57 Correct 2 ms 364 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 364 KB Output is correct
60 Correct 2 ms 364 KB Output is correct
61 Correct 2 ms 364 KB Output is correct
62 Correct 2 ms 364 KB Output is correct
63 Correct 2 ms 364 KB Output is correct
64 Correct 2 ms 364 KB Output is correct
65 Correct 2 ms 364 KB Output is correct
66 Correct 21 ms 2884 KB Output is correct
67 Correct 21 ms 2884 KB Output is correct
68 Correct 21 ms 2884 KB Output is correct
69 Correct 52 ms 2884 KB Output is correct
70 Correct 31 ms 3012 KB Output is correct
71 Correct 25 ms 2884 KB Output is correct
72 Correct 22 ms 2884 KB Output is correct
73 Correct 21 ms 2884 KB Output is correct
74 Correct 23 ms 2884 KB Output is correct
75 Correct 27 ms 2884 KB Output is correct
76 Correct 23 ms 2884 KB Output is correct
77 Correct 23 ms 2884 KB Output is correct
78 Correct 22 ms 2904 KB Output is correct
79 Correct 23 ms 2884 KB Output is correct
80 Correct 22 ms 3012 KB Output is correct
81 Correct 23 ms 2884 KB Output is correct
82 Correct 24 ms 2884 KB Output is correct
83 Correct 24 ms 2884 KB Output is correct
84 Correct 21 ms 2756 KB Output is correct
85 Correct 23 ms 2756 KB Output is correct
86 Correct 24 ms 2756 KB Output is correct
87 Correct 21 ms 2884 KB Output is correct
88 Correct 23 ms 2756 KB Output is correct
89 Correct 24 ms 2884 KB Output is correct
90 Correct 25 ms 2884 KB Output is correct
91 Correct 805 ms 72848 KB Output is correct
92 Correct 991 ms 81960 KB Output is correct
93 Correct 1008 ms 82036 KB Output is correct
94 Correct 1188 ms 82084 KB Output is correct
95 Correct 1363 ms 83952 KB Output is correct
96 Correct 1004 ms 83800 KB Output is correct
97 Correct 1008 ms 83552 KB Output is correct
98 Correct 1081 ms 83944 KB Output is correct
99 Correct 1002 ms 83684 KB Output is correct
100 Correct 1018 ms 83816 KB Output is correct
101 Correct 1137 ms 83792 KB Output is correct
102 Correct 1016 ms 83980 KB Output is correct
103 Correct 1191 ms 83684 KB Output is correct
104 Correct 1177 ms 83768 KB Output is correct
105 Correct 1887 ms 73340 KB Output is correct
106 Correct 2315 ms 82676 KB Output is correct
107 Correct 3935 ms 82636 KB Output is correct
108 Correct 2681 ms 82708 KB Output is correct
109 Correct 1107 ms 82804 KB Output is correct
110 Correct 1042 ms 82976 KB Output is correct
111 Correct 1014 ms 83824 KB Output is correct
112 Correct 1027 ms 83184 KB Output is correct
113 Correct 1039 ms 83368 KB Output is correct
114 Correct 2092 ms 83268 KB Output is correct
115 Correct 1103 ms 83956 KB Output is correct
116 Correct 1006 ms 83172 KB Output is correct
117 Correct 1045 ms 83148 KB Output is correct
118 Correct 1627 ms 83376 KB Output is correct
119 Correct 1282 ms 83824 KB Output is correct
120 Correct 1036 ms 83104 KB Output is correct
121 Correct 1080 ms 83788 KB Output is correct
122 Correct 1160 ms 83768 KB Output is correct
123 Correct 1192 ms 83044 KB Output is correct
124 Correct 1179 ms 83640 KB Output is correct
125 Correct 922 ms 83000 KB Output is correct
126 Correct 959 ms 83384 KB Output is correct
127 Correct 1004 ms 83684 KB Output is correct
128 Correct 938 ms 83412 KB Output is correct
129 Correct 909 ms 83084 KB Output is correct