답안 #221472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
221472 2020-04-10T08:52:10 Z rama_pang Wild Boar (JOI18_wild_boar) C++14
100 / 100
11017 ms 593012 KB
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

const int MAXN = 2005;
const int MAXM = 4005;
const int MAXL = 100005;
const lint INF = 1e18;

struct edge_t {
  int u, v, w; // u = from, v = to, w = weight
  edge_t() {}
  edge_t(int u, int v, int w) : u(u), v(v), w(w) {}
};

int N, M, T, L;

namespace Graph {

vector<edge_t> edges;
vector<int> adj[MAXN];

lint EdgeEdgeDistance[MAXM][MAXM]; // EdgeEdgeDistance[X][Y][Type] = Shortest Path from X.u to Y.v, where we use X and Y

lint Distance[MAXN][MAXN][7]; // Distance[A][B][Type] = Shortest Path between Vertices A and B
int FirstEdge[MAXN][MAXN][7]; // FirstEdge[A][B][Type] = first edge in the shortest path from A to B (adjacent to A)
int LastEdge[MAXN][MAXN][7]; // LastEdge[A][B][Type] = last edge in the shortest path from A to B (adjacent to B)

// Distance Types:
// 1 The overall shortest distance, which uses (X, Y)
// 2 The overall shortest distance without X and Y
// 3 The overall shortest distance without X, which uses (U, V)
// 4 The overall shortest distance without X and V
// 5 The overall shortest distance without Y, which uses (S, E)
// 6 The overall shortest distance without S and Y

void Read() {
  M *= 2;
  for (int i = 0; i < (M / 2); i++) {
    int A, B, C;
    cin >> A >> B >> C;
    A--, B--;

    adj[A].emplace_back(edges.size());
    edges.emplace_back(A, B, C);

    adj[B].emplace_back(edges.size());
    edges.emplace_back(B, A, C);
  }
}

void Dijkstra(int X) { // Finds all EdgeEdgeDistance[X][]
  priority_queue<pair<lint, int>, vector<pair<lint, int>>, greater<pair<lint, int>>> pq;
  pq.emplace(edges[X].w, X);
  EdgeEdgeDistance[X][X] = edges[X].w; // from edges[X].u to edges[X].v

  // Run Dijkstra to find EdgeEdgeDistance[X][]
  // Make sure we do not do a U-turn

  while (!pq.empty()) {
    int cur = pq.top().second;
    lint cur_dist = pq.top().first; 
    pq.pop();

    if (cur_dist != EdgeEdgeDistance[X][cur]) continue;
    int u = edges[cur].v;

    for (auto nxt : adj[u]) {
      if (cur == (nxt ^ 1)) continue; // We cannot U-turn back
      lint &nxt_dist = EdgeEdgeDistance[X][nxt];

      if (nxt_dist == -1 || nxt_dist > cur_dist + edges[nxt].w) {
        nxt_dist = cur_dist + edges[nxt].w;
        pq.emplace(nxt_dist, nxt);
      }
    }
  }
}

void AllPairsShortestPath() { // Compute everything involving Shortest Paths
  // Compute EdgeEdgeDistance[][]
  memset(EdgeEdgeDistance, -1, sizeof(EdgeEdgeDistance));
  for (int X = 0; X < M; X++) Dijkstra(X);

  // Compute Distance, FirstEdge, and LastEdge
  memset(Distance, -1, sizeof(Distance));
  memset(FirstEdge, -1, sizeof(FirstEdge));
  memset(LastEdge, -1, sizeof(LastEdge));

  // Compute Distance[][][1] = The overall shortest distance, which uses (X, Y)
  for (int X = 0; X < M; X++) {
    for (int Y = 0; Y < M; Y++) {
      if (EdgeEdgeDistance[X][Y] == -1) continue;
      int A = edges[X].u;
      int B = edges[Y].v;
      if (Distance[A][B][1] == -1 || Distance[A][B][1] > EdgeEdgeDistance[X][Y]) {
        Distance[A][B][1] = EdgeEdgeDistance[X][Y];
        FirstEdge[A][B][1] = X;
        LastEdge[A][B][1] = Y;
      }
    }
  }

  // Compute Distance[][][2] = The overall shortest distance without X and Y
  for (int I = 0; I < M; I++) {
    for (int J = 0; J < M; J++) {
      int A = edges[I].u;
      int B = edges[J].v;
      int X = FirstEdge[A][B][1];
      int Y = LastEdge[A][B][1];
      if (I == X || J == Y) continue;
      if (EdgeEdgeDistance[I][J] == -1) continue;
      if (Distance[A][B][2] == -1 || Distance[A][B][2] > EdgeEdgeDistance[I][J]) {
        Distance[A][B][2] = EdgeEdgeDistance[I][J]; 
        FirstEdge[A][B][2] = I;
        LastEdge[A][B][2] = J;
      }
    }
  }

  // Compute Distance[][][3] = The overall shortest distance without X, which uses (U, V)
  for (int U = 0; U < M; U++) {
    for (int V = 0; V < M; V++) {
      if (EdgeEdgeDistance[U][V] == -1) continue;
      int A = edges[U].u;
      int B = edges[V].v;
      int X = FirstEdge[A][B][1];
      if (U == X) continue;

      if (Distance[A][B][3] == -1 || Distance[A][B][3] > EdgeEdgeDistance[U][V]) {
        Distance[A][B][3] = EdgeEdgeDistance[U][V];
        FirstEdge[A][B][3] = U;
        LastEdge[A][B][3] = V;
      }
    }
  }

  // Compute Distance[][][4] = The overall shortest distance without X and V
  for (int I = 0; I < M; I++) {
    for (int J = 0; J < M; J++) {
      if (EdgeEdgeDistance[I][J] == -1) continue;
      int A = edges[I].u;
      int B = edges[J].v;
      int X = FirstEdge[A][B][1];
      int V = LastEdge[A][B][3];
      if (I == X || J == V) continue;

      if (Distance[A][B][4] == -1 || Distance[A][B][4] > EdgeEdgeDistance[I][J]) {
        Distance[A][B][4] = EdgeEdgeDistance[I][J];
        FirstEdge[A][B][4] = I;
        LastEdge[A][B][4] = J;
      }
    }
  }

  // Compute Distance[][][5] = The overall shortest distance without Y, which uses (S, E)
  for (int S = 0; S < M; S++) {
    for (int E = 0; E < M; E++) {
      if (EdgeEdgeDistance[S][E] == -1) continue;
      int A = edges[S].u;
      int B = edges[E].v;
      int Y = LastEdge[A][B][1];
      if (E == Y) continue;

      if (Distance[A][B][5] == -1 || Distance[A][B][5] > EdgeEdgeDistance[S][E]) {
        Distance[A][B][5] = EdgeEdgeDistance[S][E];
        FirstEdge[A][B][5] = S;
        LastEdge[A][B][5] = E;
      }
    }
  }

  // Compute Distance[][][6] = The overall shortest distance without S and Y
  for (int I = 0; I < M; I++) {
    for (int J = 0; J < M; J++) {
      if (EdgeEdgeDistance[I][J] == -1) continue;
      int A = edges[I].u;
      int B = edges[J].v;
      int S = FirstEdge[A][B][5];
      int Y = LastEdge[A][B][1];
      if (I == S || J == Y) continue;
      if (Distance[A][B][6] == -1 || Distance[A][B][6] > EdgeEdgeDistance[I][J]) {
        Distance[A][B][6] = EdgeEdgeDistance[I][J]; 
        FirstEdge[A][B][6] = I;
        LastEdge[A][B][6] = J;
      }
    }
  }
}

}

class SegmentTree {
 
 private:

  struct Data {
    array<lint, 7> dp; // dp[Type] = Answer for supply run on current segment
    array<int, 7> first_edge;
    array<int, 7> last_edge; 

    lint& operator [] (int i) { return dp[i]; }
    const lint& operator [] (int i) const { return dp[i]; }

    Data() {
      for (int i = 0; i <= 6; i++) {
        dp[i] = -1;
        first_edge[i] = -1;
        last_edge[i] = -1;
      }
    }

    Data(int u, int v) {
      for (int i = 1; i <= 6; i++) {
        dp[i] = Graph::Distance[u][v][i];
        first_edge[i] = Graph::FirstEdge[u][v][i];
        last_edge[i] = Graph::LastEdge[u][v][i];
      }
      for (int i = 1; i <= 6; i++) {
        if (dp[i] < 0) dp[i] = INF;
      }
    }

    Data(Data A, Data B) {
      if (A[1] == -1) { *this = B; return; }
      if (B[1] == -1) { *this = A; return; }
      for (int i = 1; i <= 6; i++) dp[i] = INF;
      
      // Type 1 The overall shortest distance, which uses (X, Y)
      for (int P = 1; P <= 6; P++) {
        for (int Q = 1; Q <= 6; Q++) {
          if (A.last_edge[P] == (B.first_edge[Q] ^ 1)) continue; // cannot make U-turns
          if (dp[1] > A[P] + B[Q]) {
            dp[1] = A[P] + B[Q];
            first_edge[1] = A.first_edge[P];
            last_edge[1] = B.last_edge[Q];
          }
        }
      }

      // Type 2 The overall shortest distance without X and Y
      for (int P = 1; P <= 6; P++) {
        for (int Q = 1; Q <= 6; Q++) {
          if (A.last_edge[P] == (B.first_edge[Q] ^ 1)) continue; // cannot make U-turns
          if (first_edge[1] == A.first_edge[P]) continue;
          if (last_edge[1] == B.last_edge[Q]) continue;
          if (dp[2] > A[P] + B[Q]) {
            dp[2] = A[P] + B[Q];
            first_edge[2] = A.first_edge[P];
            last_edge[2] = B.last_edge[Q];
          }
        }
      }
      
      // Type 3 The overall shortest distance without X, which uses (U, V)
      for (int P = 1; P <= 6; P++) {
        for (int Q = 1; Q <= 6; Q++) {
          if (A.last_edge[P] == (B.first_edge[Q] ^ 1)) continue; // cannot make U-turns
          if (first_edge[1] == A.first_edge[P]) continue;
          if (dp[3] > A[P] + B[Q]) {
            dp[3] = A[P] + B[Q];
            first_edge[3] = A.first_edge[P];
            last_edge[3] = B.last_edge[Q];
          }
        }
      }      

      // Type 4 The overall shortest distance without X and V
      for (int P = 1; P <= 6; P++) {
        for (int Q = 1; Q <= 6; Q++) {
          if (A.last_edge[P] == (B.first_edge[Q] ^ 1)) continue; // cannot make U-turns
          if (first_edge[1] == A.first_edge[P]) continue;
          if (last_edge[3] == B.last_edge[Q]) continue;
          if (dp[4] > A[P] + B[Q]) {
            dp[4] = A[P] + B[Q];
            first_edge[4] = A.first_edge[P];
            last_edge[4] = B.last_edge[Q];
          }
        }
      }      

      // Type 5 The overall shortest distance without Y, which uses (S, E)
      for (int P = 1; P <= 6; P++) {
        for (int Q = 1; Q <= 6; Q++) {
          if (A.last_edge[P] == (B.first_edge[Q] ^ 1)) continue; // cannot make U-turns
          if (last_edge[1] == B.last_edge[Q]) continue;
          if (dp[5] > A[P] + B[Q]) {
            dp[5] = A[P] + B[Q];
            first_edge[5] = A.first_edge[P];
            last_edge[5] = B.last_edge[Q];
          }
        }
      }      

      // Type 6 The overall shortest distance without S and Y
      for (int P = 1; P <= 6; P++) {
        for (int Q = 1; Q <= 6; Q++) {
          if (A.last_edge[P] == (B.first_edge[Q] ^ 1)) continue; // cannot make U-turns
          if (first_edge[5] == A.first_edge[P]) continue;
          if (last_edge[1] == B.last_edge[Q]) continue;
          if (dp[6] > A[P] + B[Q]) {
            dp[6] = A[P] + B[Q];
            first_edge[6] = A.first_edge[P];
            last_edge[6] = B.last_edge[Q];
          }
        }
      }      
    }
  };

  int sz;
  vector<Data> Tree;
  vector<int> X; // Supply Plan

  void Update(int pos, int u, int v) {
    Tree[pos += sz] = Data(u, v);
    for (pos /= 2; pos > 0; pos /= 2) {
      Tree[pos] = Data(Tree[pos * 2], Tree[pos * 2 + 1]);
    }
  }

  Data Query(int L, int R) {
    Data left, right;
    for (L += sz, R += sz; L < R; L /= 2, R /= 2) {
      if (L & 1) left = Data(left, Tree[L++]);
      if (R & 1) right = Data(Tree[--R], right);
    }
    return Data(left, right);
  }

 public:

  SegmentTree(vector<int> X) : X(X) {
    sz = (int) X.size() - 1;
    Tree.resize(2 * sz);

    for (int i = 0; i < sz; i++) {
      Tree[i + sz] = Data(X[i], X[i + 1]);
    }
    for (int i = sz - 1; i > 0; i--) {
      Tree[i] = Data(Tree[i * 2], Tree[i * 2 + 1]);
    }
  }

  void Update(int P, int Q) {
    X[P] = Q;
    if (P > 0) Update(P - 1, X[P - 1], X[P]);
    if (P < sz) Update(P, X[P], X[P + 1]);
  }

  lint Query() {
    lint res = Query(0, sz).dp[1];
    if (res == INF) res = -1;
    return res;
  }
};

void Solve() {
  vector<int> X(L);
  for (int i = 0; i < L; i++) {
    cin >> X[i];
    X[i]--;
  }

  SegmentTree Solver(X);
  for (int i = 0; i < T; i++) {
    int P, Q;
    cin >> P >> Q;
    Solver.Update(--P, --Q);
    cout << Solver.Query() << "\n";
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  cin >> N >> M >> T >> L;

  Graph::Read();
  Graph::AllPairsShortestPath();

  Solve();

  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 566648 KB Output is correct
2 Correct 281 ms 566516 KB Output is correct
3 Correct 286 ms 566520 KB Output is correct
4 Correct 281 ms 566580 KB Output is correct
5 Correct 282 ms 566520 KB Output is correct
6 Correct 286 ms 566576 KB Output is correct
7 Correct 280 ms 566520 KB Output is correct
8 Correct 283 ms 566496 KB Output is correct
9 Correct 278 ms 566520 KB Output is correct
10 Correct 280 ms 566520 KB Output is correct
11 Correct 288 ms 566520 KB Output is correct
12 Correct 279 ms 566544 KB Output is correct
13 Correct 278 ms 566520 KB Output is correct
14 Correct 282 ms 566524 KB Output is correct
15 Correct 280 ms 566520 KB Output is correct
16 Correct 282 ms 566520 KB Output is correct
17 Correct 276 ms 566520 KB Output is correct
18 Correct 284 ms 566520 KB Output is correct
19 Correct 282 ms 566648 KB Output is correct
20 Correct 278 ms 566520 KB Output is correct
21 Correct 288 ms 566780 KB Output is correct
22 Correct 278 ms 566520 KB Output is correct
23 Correct 285 ms 566520 KB Output is correct
24 Correct 306 ms 566520 KB Output is correct
25 Correct 283 ms 566520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 566648 KB Output is correct
2 Correct 281 ms 566516 KB Output is correct
3 Correct 286 ms 566520 KB Output is correct
4 Correct 281 ms 566580 KB Output is correct
5 Correct 282 ms 566520 KB Output is correct
6 Correct 286 ms 566576 KB Output is correct
7 Correct 280 ms 566520 KB Output is correct
8 Correct 283 ms 566496 KB Output is correct
9 Correct 278 ms 566520 KB Output is correct
10 Correct 280 ms 566520 KB Output is correct
11 Correct 288 ms 566520 KB Output is correct
12 Correct 279 ms 566544 KB Output is correct
13 Correct 278 ms 566520 KB Output is correct
14 Correct 282 ms 566524 KB Output is correct
15 Correct 280 ms 566520 KB Output is correct
16 Correct 282 ms 566520 KB Output is correct
17 Correct 276 ms 566520 KB Output is correct
18 Correct 284 ms 566520 KB Output is correct
19 Correct 282 ms 566648 KB Output is correct
20 Correct 278 ms 566520 KB Output is correct
21 Correct 288 ms 566780 KB Output is correct
22 Correct 278 ms 566520 KB Output is correct
23 Correct 285 ms 566520 KB Output is correct
24 Correct 306 ms 566520 KB Output is correct
25 Correct 283 ms 566520 KB Output is correct
26 Correct 294 ms 566496 KB Output is correct
27 Correct 358 ms 589816 KB Output is correct
28 Correct 366 ms 589944 KB Output is correct
29 Correct 469 ms 589944 KB Output is correct
30 Correct 447 ms 589952 KB Output is correct
31 Correct 441 ms 589816 KB Output is correct
32 Correct 439 ms 589792 KB Output is correct
33 Correct 472 ms 589944 KB Output is correct
34 Correct 464 ms 589948 KB Output is correct
35 Correct 413 ms 589944 KB Output is correct
36 Correct 425 ms 589816 KB Output is correct
37 Correct 469 ms 590072 KB Output is correct
38 Correct 469 ms 589944 KB Output is correct
39 Correct 438 ms 590004 KB Output is correct
40 Correct 469 ms 589944 KB Output is correct
41 Correct 465 ms 589944 KB Output is correct
42 Correct 402 ms 589816 KB Output is correct
43 Correct 438 ms 590140 KB Output is correct
44 Correct 446 ms 589944 KB Output is correct
45 Correct 394 ms 589944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 566648 KB Output is correct
2 Correct 281 ms 566516 KB Output is correct
3 Correct 286 ms 566520 KB Output is correct
4 Correct 281 ms 566580 KB Output is correct
5 Correct 282 ms 566520 KB Output is correct
6 Correct 286 ms 566576 KB Output is correct
7 Correct 280 ms 566520 KB Output is correct
8 Correct 283 ms 566496 KB Output is correct
9 Correct 278 ms 566520 KB Output is correct
10 Correct 280 ms 566520 KB Output is correct
11 Correct 288 ms 566520 KB Output is correct
12 Correct 279 ms 566544 KB Output is correct
13 Correct 278 ms 566520 KB Output is correct
14 Correct 282 ms 566524 KB Output is correct
15 Correct 280 ms 566520 KB Output is correct
16 Correct 282 ms 566520 KB Output is correct
17 Correct 276 ms 566520 KB Output is correct
18 Correct 284 ms 566520 KB Output is correct
19 Correct 282 ms 566648 KB Output is correct
20 Correct 278 ms 566520 KB Output is correct
21 Correct 288 ms 566780 KB Output is correct
22 Correct 278 ms 566520 KB Output is correct
23 Correct 285 ms 566520 KB Output is correct
24 Correct 306 ms 566520 KB Output is correct
25 Correct 283 ms 566520 KB Output is correct
26 Correct 294 ms 566496 KB Output is correct
27 Correct 358 ms 589816 KB Output is correct
28 Correct 366 ms 589944 KB Output is correct
29 Correct 469 ms 589944 KB Output is correct
30 Correct 447 ms 589952 KB Output is correct
31 Correct 441 ms 589816 KB Output is correct
32 Correct 439 ms 589792 KB Output is correct
33 Correct 472 ms 589944 KB Output is correct
34 Correct 464 ms 589948 KB Output is correct
35 Correct 413 ms 589944 KB Output is correct
36 Correct 425 ms 589816 KB Output is correct
37 Correct 469 ms 590072 KB Output is correct
38 Correct 469 ms 589944 KB Output is correct
39 Correct 438 ms 590004 KB Output is correct
40 Correct 469 ms 589944 KB Output is correct
41 Correct 465 ms 589944 KB Output is correct
42 Correct 402 ms 589816 KB Output is correct
43 Correct 438 ms 590140 KB Output is correct
44 Correct 446 ms 589944 KB Output is correct
45 Correct 394 ms 589944 KB Output is correct
46 Correct 480 ms 566776 KB Output is correct
47 Correct 6717 ms 590072 KB Output is correct
48 Correct 5944 ms 590132 KB Output is correct
49 Correct 4921 ms 590128 KB Output is correct
50 Correct 5240 ms 590072 KB Output is correct
51 Correct 5813 ms 590008 KB Output is correct
52 Correct 3916 ms 590132 KB Output is correct
53 Correct 3957 ms 590232 KB Output is correct
54 Correct 3980 ms 590228 KB Output is correct
55 Correct 3952 ms 590128 KB Output is correct
56 Correct 3927 ms 590296 KB Output is correct
57 Correct 3970 ms 590200 KB Output is correct
58 Correct 3978 ms 590224 KB Output is correct
59 Correct 3937 ms 590328 KB Output is correct
60 Correct 3852 ms 590236 KB Output is correct
61 Correct 3801 ms 590232 KB Output is correct
62 Correct 3697 ms 590180 KB Output is correct
63 Correct 3533 ms 590360 KB Output is correct
64 Correct 1919 ms 590184 KB Output is correct
65 Correct 1862 ms 590200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 566648 KB Output is correct
2 Correct 281 ms 566516 KB Output is correct
3 Correct 286 ms 566520 KB Output is correct
4 Correct 281 ms 566580 KB Output is correct
5 Correct 282 ms 566520 KB Output is correct
6 Correct 286 ms 566576 KB Output is correct
7 Correct 280 ms 566520 KB Output is correct
8 Correct 283 ms 566496 KB Output is correct
9 Correct 278 ms 566520 KB Output is correct
10 Correct 280 ms 566520 KB Output is correct
11 Correct 288 ms 566520 KB Output is correct
12 Correct 279 ms 566544 KB Output is correct
13 Correct 278 ms 566520 KB Output is correct
14 Correct 282 ms 566524 KB Output is correct
15 Correct 280 ms 566520 KB Output is correct
16 Correct 282 ms 566520 KB Output is correct
17 Correct 276 ms 566520 KB Output is correct
18 Correct 284 ms 566520 KB Output is correct
19 Correct 282 ms 566648 KB Output is correct
20 Correct 278 ms 566520 KB Output is correct
21 Correct 288 ms 566780 KB Output is correct
22 Correct 278 ms 566520 KB Output is correct
23 Correct 285 ms 566520 KB Output is correct
24 Correct 306 ms 566520 KB Output is correct
25 Correct 283 ms 566520 KB Output is correct
26 Correct 294 ms 566496 KB Output is correct
27 Correct 358 ms 589816 KB Output is correct
28 Correct 366 ms 589944 KB Output is correct
29 Correct 469 ms 589944 KB Output is correct
30 Correct 447 ms 589952 KB Output is correct
31 Correct 441 ms 589816 KB Output is correct
32 Correct 439 ms 589792 KB Output is correct
33 Correct 472 ms 589944 KB Output is correct
34 Correct 464 ms 589948 KB Output is correct
35 Correct 413 ms 589944 KB Output is correct
36 Correct 425 ms 589816 KB Output is correct
37 Correct 469 ms 590072 KB Output is correct
38 Correct 469 ms 589944 KB Output is correct
39 Correct 438 ms 590004 KB Output is correct
40 Correct 469 ms 589944 KB Output is correct
41 Correct 465 ms 589944 KB Output is correct
42 Correct 402 ms 589816 KB Output is correct
43 Correct 438 ms 590140 KB Output is correct
44 Correct 446 ms 589944 KB Output is correct
45 Correct 394 ms 589944 KB Output is correct
46 Correct 480 ms 566776 KB Output is correct
47 Correct 6717 ms 590072 KB Output is correct
48 Correct 5944 ms 590132 KB Output is correct
49 Correct 4921 ms 590128 KB Output is correct
50 Correct 5240 ms 590072 KB Output is correct
51 Correct 5813 ms 590008 KB Output is correct
52 Correct 3916 ms 590132 KB Output is correct
53 Correct 3957 ms 590232 KB Output is correct
54 Correct 3980 ms 590228 KB Output is correct
55 Correct 3952 ms 590128 KB Output is correct
56 Correct 3927 ms 590296 KB Output is correct
57 Correct 3970 ms 590200 KB Output is correct
58 Correct 3978 ms 590224 KB Output is correct
59 Correct 3937 ms 590328 KB Output is correct
60 Correct 3852 ms 590236 KB Output is correct
61 Correct 3801 ms 590232 KB Output is correct
62 Correct 3697 ms 590180 KB Output is correct
63 Correct 3533 ms 590360 KB Output is correct
64 Correct 1919 ms 590184 KB Output is correct
65 Correct 1862 ms 590200 KB Output is correct
66 Correct 404 ms 589816 KB Output is correct
67 Correct 1521 ms 567672 KB Output is correct
68 Correct 1189 ms 566776 KB Output is correct
69 Correct 2249 ms 567820 KB Output is correct
70 Correct 3706 ms 591216 KB Output is correct
71 Correct 11017 ms 592116 KB Output is correct
72 Correct 9976 ms 592040 KB Output is correct
73 Correct 7961 ms 592728 KB Output is correct
74 Correct 7871 ms 592340 KB Output is correct
75 Correct 7944 ms 592412 KB Output is correct
76 Correct 9004 ms 591912 KB Output is correct
77 Correct 9793 ms 591972 KB Output is correct
78 Correct 9470 ms 591780 KB Output is correct
79 Correct 8032 ms 592796 KB Output is correct
80 Correct 8010 ms 592704 KB Output is correct
81 Correct 9117 ms 591952 KB Output is correct
82 Correct 7767 ms 592404 KB Output is correct
83 Correct 8170 ms 591824 KB Output is correct
84 Correct 6946 ms 592764 KB Output is correct
85 Correct 5341 ms 593012 KB Output is correct