Submission #387470

# Submission time Handle Problem Language Result Execution time Memory
387470 2021-04-08T13:02:18 Z rama_pang IOI Fever (JOI21_fever) C++17
100 / 100
3219 ms 76000 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) {
  vector<array<lint, 5>> ls;
  vector<array<lint, 3>> idx;

  for (int i = 0; i < N; i++) {
    idx.push_back({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));
  sort(begin(idx), end(idx));

  const auto GetIndex = [&](int x, int y) {
    auto it = lower_bound(begin(idx), end(idx), array<lint, 3>({x, y, -1}));
    return (*it)[2];
  };

  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 GetIndex((*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 GetIndex((*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 GetIndex((*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 GetIndex((*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 GetIndex((*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 GetIndex((*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 GetIndex((*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 GetIndex((*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:240:8: warning: unused variable 'start' [-Wunused-variable]
  240 |   auto start = clock();
      |        ^~~~~
fever.cpp: In lambda function:
fever.cpp:114:3: warning: control reaches end of non-void function [-Wreturn-type]
  114 |   };
      |   ^
# 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 2 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 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 2 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 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 4 ms 396 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 2 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 2 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 2 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 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 4 ms 396 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 2 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 2 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 1 ms 364 KB Output is correct
56 Correct 1 ms 364 KB Output is correct
57 Correct 1 ms 364 KB Output is correct
58 Correct 2 ms 364 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 1 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 2 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 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 4 ms 396 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 2 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 2 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 1 ms 364 KB Output is correct
56 Correct 1 ms 364 KB Output is correct
57 Correct 1 ms 364 KB Output is correct
58 Correct 2 ms 364 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 1 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 22 ms 2676 KB Output is correct
67 Correct 22 ms 2676 KB Output is correct
68 Correct 22 ms 2676 KB Output is correct
69 Correct 51 ms 2672 KB Output is correct
70 Correct 31 ms 2676 KB Output is correct
71 Correct 26 ms 2676 KB Output is correct
72 Correct 22 ms 2676 KB Output is correct
73 Correct 23 ms 2676 KB Output is correct
74 Correct 24 ms 2676 KB Output is correct
75 Correct 28 ms 2676 KB Output is correct
76 Correct 23 ms 2804 KB Output is correct
77 Correct 23 ms 2676 KB Output is correct
78 Correct 22 ms 2676 KB Output is correct
79 Correct 23 ms 2676 KB Output is correct
80 Correct 22 ms 2696 KB Output is correct
81 Correct 23 ms 2676 KB Output is correct
82 Correct 25 ms 2676 KB Output is correct
83 Correct 26 ms 2676 KB Output is correct
84 Correct 24 ms 2676 KB Output is correct
85 Correct 24 ms 2676 KB Output is correct
86 Correct 25 ms 2676 KB Output is correct
87 Correct 23 ms 2676 KB Output is correct
88 Correct 23 ms 2676 KB Output is correct
89 Correct 25 ms 2676 KB Output is correct
90 Correct 25 ms 2676 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 2 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 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 4 ms 396 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 2 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 2 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 1 ms 364 KB Output is correct
56 Correct 1 ms 364 KB Output is correct
57 Correct 1 ms 364 KB Output is correct
58 Correct 2 ms 364 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 1 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 720 ms 68712 KB Output is correct
67 Correct 888 ms 75732 KB Output is correct
68 Correct 864 ms 75836 KB Output is correct
69 Correct 996 ms 75984 KB Output is correct
70 Correct 1168 ms 75672 KB Output is correct
71 Correct 860 ms 75768 KB Output is correct
72 Correct 879 ms 75796 KB Output is correct
73 Correct 942 ms 75668 KB Output is correct
74 Correct 860 ms 75508 KB Output is correct
75 Correct 878 ms 75708 KB Output is correct
76 Correct 989 ms 75544 KB Output is correct
77 Correct 870 ms 75720 KB Output is correct
78 Correct 1029 ms 75660 KB Output is correct
79 Correct 1034 ms 75508 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 2 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 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 4 ms 396 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 2 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 2 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 1 ms 364 KB Output is correct
56 Correct 1 ms 364 KB Output is correct
57 Correct 1 ms 364 KB Output is correct
58 Correct 2 ms 364 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 1 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 22 ms 2676 KB Output is correct
67 Correct 22 ms 2676 KB Output is correct
68 Correct 22 ms 2676 KB Output is correct
69 Correct 51 ms 2672 KB Output is correct
70 Correct 31 ms 2676 KB Output is correct
71 Correct 26 ms 2676 KB Output is correct
72 Correct 22 ms 2676 KB Output is correct
73 Correct 23 ms 2676 KB Output is correct
74 Correct 24 ms 2676 KB Output is correct
75 Correct 28 ms 2676 KB Output is correct
76 Correct 23 ms 2804 KB Output is correct
77 Correct 23 ms 2676 KB Output is correct
78 Correct 22 ms 2676 KB Output is correct
79 Correct 23 ms 2676 KB Output is correct
80 Correct 22 ms 2696 KB Output is correct
81 Correct 23 ms 2676 KB Output is correct
82 Correct 25 ms 2676 KB Output is correct
83 Correct 26 ms 2676 KB Output is correct
84 Correct 24 ms 2676 KB Output is correct
85 Correct 24 ms 2676 KB Output is correct
86 Correct 25 ms 2676 KB Output is correct
87 Correct 23 ms 2676 KB Output is correct
88 Correct 23 ms 2676 KB Output is correct
89 Correct 25 ms 2676 KB Output is correct
90 Correct 25 ms 2676 KB Output is correct
91 Correct 720 ms 68712 KB Output is correct
92 Correct 888 ms 75732 KB Output is correct
93 Correct 864 ms 75836 KB Output is correct
94 Correct 996 ms 75984 KB Output is correct
95 Correct 1168 ms 75672 KB Output is correct
96 Correct 860 ms 75768 KB Output is correct
97 Correct 879 ms 75796 KB Output is correct
98 Correct 942 ms 75668 KB Output is correct
99 Correct 860 ms 75508 KB Output is correct
100 Correct 878 ms 75708 KB Output is correct
101 Correct 989 ms 75544 KB Output is correct
102 Correct 870 ms 75720 KB Output is correct
103 Correct 1029 ms 75660 KB Output is correct
104 Correct 1034 ms 75508 KB Output is correct
105 Correct 1629 ms 68752 KB Output is correct
106 Correct 1946 ms 75796 KB Output is correct
107 Correct 3219 ms 75736 KB Output is correct
108 Correct 2174 ms 75648 KB Output is correct
109 Correct 982 ms 75640 KB Output is correct
110 Correct 903 ms 75508 KB Output is correct
111 Correct 870 ms 75544 KB Output is correct
112 Correct 884 ms 75484 KB Output is correct
113 Correct 886 ms 75544 KB Output is correct
114 Correct 1705 ms 76000 KB Output is correct
115 Correct 939 ms 75672 KB Output is correct
116 Correct 878 ms 75632 KB Output is correct
117 Correct 910 ms 75548 KB Output is correct
118 Correct 1356 ms 75592 KB Output is correct
119 Correct 1086 ms 75604 KB Output is correct
120 Correct 878 ms 75476 KB Output is correct
121 Correct 918 ms 75540 KB Output is correct
122 Correct 1002 ms 75508 KB Output is correct
123 Correct 1045 ms 75544 KB Output is correct
124 Correct 1041 ms 75680 KB Output is correct
125 Correct 897 ms 75592 KB Output is correct
126 Correct 947 ms 75528 KB Output is correct
127 Correct 1002 ms 75640 KB Output is correct
128 Correct 936 ms 75484 KB Output is correct
129 Correct 913 ms 75628 KB Output is correct