Submission #1105428

# Submission time Handle Problem Language Result Execution time Memory
1105428 2024-10-26T11:01:28 Z duckindog Maze (JOI23_ho_t3) C++17
51 / 100
2000 ms 281700 KB
#include <bits/stdc++.h>

using namespace std;

const int dx[] = {1, 0, -1, 0},
          dy[] = {0, 1, 0, -1};

struct DSU { 
  vector<int> id;
  DSU(int n) : id(n, -1) {}
  int root(int u) { return id[u] < 0 ? u : id[u] = root(id[u]); }
  void add(int u, int v) { 
    u = root(u); v = root(v);
    if (u == v) return;
    id[u] += id[v];
    id[v] = u;
  }
};

int32_t main() { 
  cin.tie(0)->sync_with_stdio(0);

  int r, c, n; cin >> r >> c >> n;
  int Sr, Sc; cin >> Sr >> Sc;
  int Gr, Gc; cin >> Gr >> Gc;

  vector<vector<char>> a(r + 10, vector<char>(c + 10));
  for (int i = 1; i <= r; ++i) { 
    for (int j = 1; j <= c; ++j) cin >> a[i][j];
  }
  auto in = [&](int x, int y) { return 1 <= x && x <= r && 1 <= y && y <= c; };

  vector<DSU> R(r + 10, DSU(c + 10));
  vector<DSU> C(c + 10, DSU(r + 10));
  
  vector<vector<int>> f(r + 10, vector<int>(c + 10, 1'000'000'000));
  deque<pair<int, int>> q;
  q.push_back({Sr, Sc});
  f[Sr][Sc] = 0;
  while (q.size()) { 
    auto [x, y] = q.front(); q.pop_front();
    auto add = [&](int nX, int nY, int w) { 
      if (f[nX][nY] > f[x][y] + w) { 
        f[nX][nY] = f[x][y] + w;

        if (w) q.push_back({nX, nY});
        else q.push_front({nX, nY});
      }
    };

    for (int t = 0; t < 4; ++t) { 
      int nX = x + dx[t], nY = y + dy[t];
      if (!in(nX, nY) || a[nX][nY] == '#') continue;
      add(nX, nY, 0);
    }

    { //add a fricking regtangle
      int stX = max(1, x - n + 1), edX = min(r, x + n - 1);
      int stY = max(1, y - n), edY = min(c, y + n);
      
      for (int h = stX; h <= edX; h = C[stY].root(h)) {
        add(h, stY, 1);  
        for (int i = R[h].root(stY); i < edY; i = R[h].root(i)) {
          R[h].add(R[h].root(i) + 1, R[h].root(i));
          add(h, R[h].root(i), 1);
        }
        if (R[h].root(stY) - stY >= 2 * n + 1) C[stY].add(h + 1, h);
        h += 1;
      }
    }

    { //add 2 fricking strips due to the rectangle is not the fucking square
      int stX = max(1, x - n), edX = min(r, x + n);
      int stY = max(1, y - n + 1), edY = min(c, y + n - 1);
      
      for (int type = 0; type < 2; ++type) { 
        int h = (!type ? stX : edX);
        
        add(h, stY, 1);
        for (int i = R[h].root(stY); i < edY; i = R[h].root(i)) {
          R[h].add(R[h].root(i) + 1, R[h].root(i));
          add(h, R[h].root(i), 1);
        }
        if (R[h].root(stY) - stY >= 2 * n + 1) C[stY].add(h + 1, h);
      }
    }
  }

  cout << f[Gr][Gc] << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 9 ms 9112 KB Output is correct
21 Correct 5 ms 1360 KB Output is correct
22 Correct 8 ms 1104 KB Output is correct
23 Correct 5 ms 1276 KB Output is correct
24 Correct 12 ms 11500 KB Output is correct
25 Correct 12 ms 11620 KB Output is correct
26 Correct 8 ms 1528 KB Output is correct
27 Correct 8 ms 1404 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 18 ms 2420 KB Output is correct
30 Correct 10 ms 6224 KB Output is correct
31 Correct 10 ms 3152 KB Output is correct
32 Correct 18 ms 2384 KB Output is correct
33 Correct 10 ms 2384 KB Output is correct
34 Correct 27 ms 28676 KB Output is correct
35 Correct 27 ms 28528 KB Output is correct
36 Correct 18 ms 2580 KB Output is correct
37 Correct 18 ms 2712 KB Output is correct
38 Correct 12 ms 2540 KB Output is correct
39 Correct 145 ms 20048 KB Output is correct
40 Correct 24 ms 4344 KB Output is correct
41 Correct 37 ms 35012 KB Output is correct
42 Correct 24 ms 3408 KB Output is correct
43 Correct 38 ms 24436 KB Output is correct
44 Correct 101 ms 31600 KB Output is correct
45 Correct 94 ms 38432 KB Output is correct
46 Correct 133 ms 26952 KB Output is correct
47 Correct 201 ms 20040 KB Output is correct
48 Correct 145 ms 20032 KB Output is correct
49 Correct 225 ms 280740 KB Output is correct
50 Correct 251 ms 281700 KB Output is correct
51 Correct 202 ms 21556 KB Output is correct
52 Correct 198 ms 21064 KB Output is correct
53 Correct 155 ms 21540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 1 ms 592 KB Output is correct
17 Correct 2 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 504 KB Output is correct
12 Correct 1 ms 592 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 592 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 7 ms 1084 KB Output is correct
26 Correct 11 ms 1872 KB Output is correct
27 Correct 5 ms 1616 KB Output is correct
28 Correct 234 ms 1968 KB Output is correct
29 Correct 108 ms 1872 KB Output is correct
30 Correct 100 ms 1872 KB Output is correct
31 Correct 23 ms 1360 KB Output is correct
32 Correct 8 ms 1360 KB Output is correct
33 Correct 8 ms 1360 KB Output is correct
34 Correct 32 ms 3408 KB Output is correct
35 Correct 11 ms 3320 KB Output is correct
36 Correct 818 ms 4484 KB Output is correct
37 Correct 392 ms 3912 KB Output is correct
38 Correct 403 ms 3744 KB Output is correct
39 Correct 97 ms 10700 KB Output is correct
40 Correct 246 ms 31692 KB Output is correct
41 Correct 111 ms 26188 KB Output is correct
42 Execution timed out 2062 ms 33592 KB Time limit exceeded
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 1 ms 592 KB Output is correct
17 Correct 2 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 504 KB Output is correct
33 Correct 6 ms 1360 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 2 ms 1016 KB Output is correct
36 Correct 7 ms 860 KB Output is correct
37 Correct 12 ms 9112 KB Output is correct
38 Correct 13 ms 1872 KB Output is correct
39 Correct 6 ms 1616 KB Output is correct
40 Correct 10 ms 1396 KB Output is correct
41 Correct 8 ms 1104 KB Output is correct
42 Correct 207 ms 1900 KB Output is correct
43 Correct 100 ms 1616 KB Output is correct
44 Correct 114 ms 1864 KB Output is correct
45 Correct 15 ms 11620 KB Output is correct
46 Correct 14 ms 11620 KB Output is correct
47 Correct 10 ms 6280 KB Output is correct
48 Correct 9 ms 1872 KB Output is correct
49 Correct 11 ms 1616 KB Output is correct
50 Correct 18 ms 1360 KB Output is correct
51 Correct 24 ms 1536 KB Output is correct
52 Correct 8 ms 1360 KB Output is correct
53 Correct 8 ms 1348 KB Output is correct
54 Correct 6 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 1 ms 592 KB Output is correct
17 Correct 2 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 504 KB Output is correct
33 Correct 6 ms 1360 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 2 ms 1016 KB Output is correct
36 Correct 7 ms 860 KB Output is correct
37 Correct 12 ms 9112 KB Output is correct
38 Correct 13 ms 1872 KB Output is correct
39 Correct 6 ms 1616 KB Output is correct
40 Correct 10 ms 1396 KB Output is correct
41 Correct 8 ms 1104 KB Output is correct
42 Correct 207 ms 1900 KB Output is correct
43 Correct 100 ms 1616 KB Output is correct
44 Correct 114 ms 1864 KB Output is correct
45 Correct 15 ms 11620 KB Output is correct
46 Correct 14 ms 11620 KB Output is correct
47 Correct 10 ms 6280 KB Output is correct
48 Correct 9 ms 1872 KB Output is correct
49 Correct 11 ms 1616 KB Output is correct
50 Correct 18 ms 1360 KB Output is correct
51 Correct 24 ms 1536 KB Output is correct
52 Correct 8 ms 1360 KB Output is correct
53 Correct 8 ms 1348 KB Output is correct
54 Correct 6 ms 1360 KB Output is correct
55 Correct 15 ms 2640 KB Output is correct
56 Correct 11 ms 6480 KB Output is correct
57 Correct 34 ms 3280 KB Output is correct
58 Correct 22 ms 3920 KB Output is correct
59 Correct 11 ms 3320 KB Output is correct
60 Correct 20 ms 2676 KB Output is correct
61 Correct 11 ms 2692 KB Output is correct
62 Correct 864 ms 4424 KB Output is correct
63 Correct 399 ms 3664 KB Output is correct
64 Correct 379 ms 3664 KB Output is correct
65 Correct 31 ms 28520 KB Output is correct
66 Correct 28 ms 28544 KB Output is correct
67 Correct 25 ms 14964 KB Output is correct
68 Correct 28 ms 3632 KB Output is correct
69 Correct 38 ms 3152 KB Output is correct
70 Correct 19 ms 3088 KB Output is correct
71 Correct 61 ms 2896 KB Output is correct
72 Correct 19 ms 2640 KB Output is correct
73 Correct 18 ms 2640 KB Output is correct
74 Correct 11 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 9 ms 9112 KB Output is correct
21 Correct 5 ms 1360 KB Output is correct
22 Correct 8 ms 1104 KB Output is correct
23 Correct 5 ms 1276 KB Output is correct
24 Correct 12 ms 11500 KB Output is correct
25 Correct 12 ms 11620 KB Output is correct
26 Correct 8 ms 1528 KB Output is correct
27 Correct 8 ms 1404 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 18 ms 2420 KB Output is correct
30 Correct 10 ms 6224 KB Output is correct
31 Correct 10 ms 3152 KB Output is correct
32 Correct 18 ms 2384 KB Output is correct
33 Correct 10 ms 2384 KB Output is correct
34 Correct 27 ms 28676 KB Output is correct
35 Correct 27 ms 28528 KB Output is correct
36 Correct 18 ms 2580 KB Output is correct
37 Correct 18 ms 2712 KB Output is correct
38 Correct 12 ms 2540 KB Output is correct
39 Correct 145 ms 20048 KB Output is correct
40 Correct 24 ms 4344 KB Output is correct
41 Correct 37 ms 35012 KB Output is correct
42 Correct 24 ms 3408 KB Output is correct
43 Correct 38 ms 24436 KB Output is correct
44 Correct 101 ms 31600 KB Output is correct
45 Correct 94 ms 38432 KB Output is correct
46 Correct 133 ms 26952 KB Output is correct
47 Correct 201 ms 20040 KB Output is correct
48 Correct 145 ms 20032 KB Output is correct
49 Correct 225 ms 280740 KB Output is correct
50 Correct 251 ms 281700 KB Output is correct
51 Correct 202 ms 21556 KB Output is correct
52 Correct 198 ms 21064 KB Output is correct
53 Correct 155 ms 21540 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 336 KB Output is correct
63 Correct 1 ms 336 KB Output is correct
64 Correct 1 ms 336 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 1 ms 336 KB Output is correct
68 Correct 1 ms 592 KB Output is correct
69 Correct 1 ms 592 KB Output is correct
70 Correct 2 ms 336 KB Output is correct
71 Correct 1 ms 336 KB Output is correct
72 Correct 1 ms 336 KB Output is correct
73 Correct 1 ms 336 KB Output is correct
74 Correct 1 ms 336 KB Output is correct
75 Correct 1 ms 336 KB Output is correct
76 Correct 1 ms 336 KB Output is correct
77 Correct 1 ms 336 KB Output is correct
78 Correct 1 ms 336 KB Output is correct
79 Correct 1 ms 336 KB Output is correct
80 Correct 1 ms 336 KB Output is correct
81 Correct 1 ms 336 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 1 ms 336 KB Output is correct
85 Correct 1 ms 504 KB Output is correct
86 Correct 1 ms 336 KB Output is correct
87 Correct 1 ms 336 KB Output is correct
88 Correct 1 ms 336 KB Output is correct
89 Correct 1 ms 508 KB Output is correct
90 Correct 1 ms 336 KB Output is correct
91 Correct 1 ms 336 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 336 KB Output is correct
95 Correct 1 ms 336 KB Output is correct
96 Correct 1 ms 504 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 1 ms 336 KB Output is correct
100 Correct 1 ms 336 KB Output is correct
101 Correct 1 ms 336 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 460 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 592 KB Output is correct
106 Correct 1 ms 336 KB Output is correct
107 Correct 1 ms 336 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 1 ms 336 KB Output is correct
110 Correct 7 ms 1084 KB Output is correct
111 Correct 11 ms 1872 KB Output is correct
112 Correct 5 ms 1616 KB Output is correct
113 Correct 234 ms 1968 KB Output is correct
114 Correct 108 ms 1872 KB Output is correct
115 Correct 100 ms 1872 KB Output is correct
116 Correct 23 ms 1360 KB Output is correct
117 Correct 8 ms 1360 KB Output is correct
118 Correct 8 ms 1360 KB Output is correct
119 Correct 32 ms 3408 KB Output is correct
120 Correct 11 ms 3320 KB Output is correct
121 Correct 818 ms 4484 KB Output is correct
122 Correct 392 ms 3912 KB Output is correct
123 Correct 403 ms 3744 KB Output is correct
124 Correct 97 ms 10700 KB Output is correct
125 Correct 246 ms 31692 KB Output is correct
126 Correct 111 ms 26188 KB Output is correct
127 Execution timed out 2062 ms 33592 KB Time limit exceeded
128 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 9 ms 9112 KB Output is correct
21 Correct 5 ms 1360 KB Output is correct
22 Correct 8 ms 1104 KB Output is correct
23 Correct 5 ms 1276 KB Output is correct
24 Correct 12 ms 11500 KB Output is correct
25 Correct 12 ms 11620 KB Output is correct
26 Correct 8 ms 1528 KB Output is correct
27 Correct 8 ms 1404 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 18 ms 2420 KB Output is correct
30 Correct 10 ms 6224 KB Output is correct
31 Correct 10 ms 3152 KB Output is correct
32 Correct 18 ms 2384 KB Output is correct
33 Correct 10 ms 2384 KB Output is correct
34 Correct 27 ms 28676 KB Output is correct
35 Correct 27 ms 28528 KB Output is correct
36 Correct 18 ms 2580 KB Output is correct
37 Correct 18 ms 2712 KB Output is correct
38 Correct 12 ms 2540 KB Output is correct
39 Correct 145 ms 20048 KB Output is correct
40 Correct 24 ms 4344 KB Output is correct
41 Correct 37 ms 35012 KB Output is correct
42 Correct 24 ms 3408 KB Output is correct
43 Correct 38 ms 24436 KB Output is correct
44 Correct 101 ms 31600 KB Output is correct
45 Correct 94 ms 38432 KB Output is correct
46 Correct 133 ms 26952 KB Output is correct
47 Correct 201 ms 20040 KB Output is correct
48 Correct 145 ms 20032 KB Output is correct
49 Correct 225 ms 280740 KB Output is correct
50 Correct 251 ms 281700 KB Output is correct
51 Correct 202 ms 21556 KB Output is correct
52 Correct 198 ms 21064 KB Output is correct
53 Correct 155 ms 21540 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 336 KB Output is correct
63 Correct 1 ms 336 KB Output is correct
64 Correct 1 ms 336 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 1 ms 336 KB Output is correct
68 Correct 1 ms 592 KB Output is correct
69 Correct 1 ms 592 KB Output is correct
70 Correct 2 ms 336 KB Output is correct
71 Correct 1 ms 336 KB Output is correct
72 Correct 1 ms 336 KB Output is correct
73 Correct 1 ms 336 KB Output is correct
74 Correct 1 ms 336 KB Output is correct
75 Correct 1 ms 336 KB Output is correct
76 Correct 1 ms 336 KB Output is correct
77 Correct 1 ms 336 KB Output is correct
78 Correct 1 ms 336 KB Output is correct
79 Correct 1 ms 336 KB Output is correct
80 Correct 1 ms 336 KB Output is correct
81 Correct 1 ms 336 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 1 ms 336 KB Output is correct
85 Correct 1 ms 504 KB Output is correct
86 Correct 1 ms 336 KB Output is correct
87 Correct 1 ms 336 KB Output is correct
88 Correct 1 ms 336 KB Output is correct
89 Correct 1 ms 508 KB Output is correct
90 Correct 1 ms 336 KB Output is correct
91 Correct 1 ms 336 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 336 KB Output is correct
95 Correct 1 ms 336 KB Output is correct
96 Correct 1 ms 504 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 1 ms 336 KB Output is correct
100 Correct 1 ms 336 KB Output is correct
101 Correct 1 ms 336 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 460 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 592 KB Output is correct
106 Correct 1 ms 336 KB Output is correct
107 Correct 1 ms 336 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 1 ms 336 KB Output is correct
110 Correct 7 ms 1084 KB Output is correct
111 Correct 11 ms 1872 KB Output is correct
112 Correct 5 ms 1616 KB Output is correct
113 Correct 234 ms 1968 KB Output is correct
114 Correct 108 ms 1872 KB Output is correct
115 Correct 100 ms 1872 KB Output is correct
116 Correct 23 ms 1360 KB Output is correct
117 Correct 8 ms 1360 KB Output is correct
118 Correct 8 ms 1360 KB Output is correct
119 Correct 32 ms 3408 KB Output is correct
120 Correct 11 ms 3320 KB Output is correct
121 Correct 818 ms 4484 KB Output is correct
122 Correct 392 ms 3912 KB Output is correct
123 Correct 403 ms 3744 KB Output is correct
124 Correct 97 ms 10700 KB Output is correct
125 Correct 246 ms 31692 KB Output is correct
126 Correct 111 ms 26188 KB Output is correct
127 Execution timed out 2062 ms 33592 KB Time limit exceeded
128 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 9 ms 9112 KB Output is correct
21 Correct 5 ms 1360 KB Output is correct
22 Correct 8 ms 1104 KB Output is correct
23 Correct 5 ms 1276 KB Output is correct
24 Correct 12 ms 11500 KB Output is correct
25 Correct 12 ms 11620 KB Output is correct
26 Correct 8 ms 1528 KB Output is correct
27 Correct 8 ms 1404 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 18 ms 2420 KB Output is correct
30 Correct 10 ms 6224 KB Output is correct
31 Correct 10 ms 3152 KB Output is correct
32 Correct 18 ms 2384 KB Output is correct
33 Correct 10 ms 2384 KB Output is correct
34 Correct 27 ms 28676 KB Output is correct
35 Correct 27 ms 28528 KB Output is correct
36 Correct 18 ms 2580 KB Output is correct
37 Correct 18 ms 2712 KB Output is correct
38 Correct 12 ms 2540 KB Output is correct
39 Correct 145 ms 20048 KB Output is correct
40 Correct 24 ms 4344 KB Output is correct
41 Correct 37 ms 35012 KB Output is correct
42 Correct 24 ms 3408 KB Output is correct
43 Correct 38 ms 24436 KB Output is correct
44 Correct 101 ms 31600 KB Output is correct
45 Correct 94 ms 38432 KB Output is correct
46 Correct 133 ms 26952 KB Output is correct
47 Correct 201 ms 20040 KB Output is correct
48 Correct 145 ms 20032 KB Output is correct
49 Correct 225 ms 280740 KB Output is correct
50 Correct 251 ms 281700 KB Output is correct
51 Correct 202 ms 21556 KB Output is correct
52 Correct 198 ms 21064 KB Output is correct
53 Correct 155 ms 21540 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 336 KB Output is correct
63 Correct 1 ms 336 KB Output is correct
64 Correct 1 ms 336 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 1 ms 336 KB Output is correct
68 Correct 1 ms 592 KB Output is correct
69 Correct 1 ms 592 KB Output is correct
70 Correct 2 ms 336 KB Output is correct
71 Correct 1 ms 336 KB Output is correct
72 Correct 1 ms 336 KB Output is correct
73 Correct 1 ms 336 KB Output is correct
74 Correct 1 ms 336 KB Output is correct
75 Correct 1 ms 336 KB Output is correct
76 Correct 1 ms 336 KB Output is correct
77 Correct 1 ms 336 KB Output is correct
78 Correct 1 ms 336 KB Output is correct
79 Correct 1 ms 336 KB Output is correct
80 Correct 1 ms 336 KB Output is correct
81 Correct 1 ms 336 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 1 ms 336 KB Output is correct
85 Correct 1 ms 504 KB Output is correct
86 Correct 1 ms 336 KB Output is correct
87 Correct 1 ms 336 KB Output is correct
88 Correct 1 ms 336 KB Output is correct
89 Correct 1 ms 508 KB Output is correct
90 Correct 1 ms 336 KB Output is correct
91 Correct 1 ms 336 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 336 KB Output is correct
95 Correct 1 ms 336 KB Output is correct
96 Correct 1 ms 504 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 1 ms 336 KB Output is correct
100 Correct 1 ms 336 KB Output is correct
101 Correct 1 ms 336 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 460 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 592 KB Output is correct
106 Correct 1 ms 336 KB Output is correct
107 Correct 1 ms 336 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 1 ms 336 KB Output is correct
110 Correct 7 ms 1084 KB Output is correct
111 Correct 11 ms 1872 KB Output is correct
112 Correct 5 ms 1616 KB Output is correct
113 Correct 234 ms 1968 KB Output is correct
114 Correct 108 ms 1872 KB Output is correct
115 Correct 100 ms 1872 KB Output is correct
116 Correct 23 ms 1360 KB Output is correct
117 Correct 8 ms 1360 KB Output is correct
118 Correct 8 ms 1360 KB Output is correct
119 Correct 32 ms 3408 KB Output is correct
120 Correct 11 ms 3320 KB Output is correct
121 Correct 818 ms 4484 KB Output is correct
122 Correct 392 ms 3912 KB Output is correct
123 Correct 403 ms 3744 KB Output is correct
124 Correct 97 ms 10700 KB Output is correct
125 Correct 246 ms 31692 KB Output is correct
126 Correct 111 ms 26188 KB Output is correct
127 Execution timed out 2062 ms 33592 KB Time limit exceeded
128 Halted 0 ms 0 KB -