Submission #839447

# Submission time Handle Problem Language Result Execution time Memory
839447 2023-08-30T04:04:25 Z dong_liu Maze (JOI23_ho_t3) C++17
94 / 100
2000 ms 858184 KB
#include "bits/stdc++.h"

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif

typedef pair<int, int> pi;

struct Range {
  vector<int> p;
  vector<bool> rem;

  Range(int n) : p(n), rem(n, false) {
    for (int i = 0; i < n; i++) p[i] = i;
  }
  int dsf(int i) {
    return p[i] == i ? i : p[i] = dsf(p[i]);
  }
  void dsj(int i, int j) { p[dsf(i)] = dsf(j); }
  bool has(int i) { return !rem[i]; }
  void remove(int i) {
    if (i > 0 && rem[i-1]) dsj(i-1, i);
    if (i+1 < int(p.size()) && rem[i+1]) dsj(i, i+1);
    rem[i] = 1;
  }
  int next(int i) {
    return i == int(p.size()) ? p.size() : !rem[i] ? i : dsf(i)+1;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.exceptions(cin.failbit);
  cin.tie(NULL);
  int k, n, m;
  cin >> n >> m >> k;
  int i1, j1, i2, j2;
  cin >> i1 >> j1 >> i2 >> j2, i1--, j1--, i2--, j2--;
  vector<string> g(n);
  for (int i = 0; i < n; i++) cin >> g[i];
  vector<Range> row, col;
  for (int i = 0; i < n; i++) row.push_back(Range(m));
  for (int i = 0; i < m; i++) col.push_back(Range(n));
  vector d(n, vector<int>(m, -1));
  vector<pi> f;
  vector fl(n, vector<int>(m, false));
  d[i1][j1] = 0, f.push_back({i1, j1}), row[i1].remove(j1), col[j1].remove(i1);
  for (int x = 0; ; x++) {
    for (int p = 0; p < int(f.size()); p++) {
      auto [i,j] = f[p];
      fl[i][j] = true;
      if (i == i2 && j == j2) {
        cout << x << '\n';
        return 0;
      }
      if (i > 0 && g[i-1][j] == '.' && d[i-1][j] == -1)
        d[i-1][j] = x, f.push_back({i-1,j}), row[i-1].remove(j), col[j].remove(i-1);
      if (i+1 < n && g[i+1][j] == '.' && d[i+1][j] == -1)
        d[i+1][j] = x, f.push_back({i+1,j}), row[i+1].remove(j), col[j].remove(i+1);
      if (j > 0 && g[i][j-1] == '.' && d[i][j-1] == -1)
        d[i][j-1] = x, f.push_back({i,j-1}), row[i].remove(j-1), col[j-1].remove(i);
      if (j+1 < m && g[i][j+1] == '.' && d[i][j+1] == -1)
        d[i][j+1] = x, f.push_back({i,j+1}), row[i].remove(j+1), col[j+1].remove(i);
    }
    vector<pi> half = f, g;
    for (auto [i,j] : f) {
      int p = row[i].next(max(0,j-k));
      while (p < m && p <= j+k) {
        d[i][p] = x+1;
        if (abs(p-j) != k) {
          row[i].remove(p), col[p].remove(i);
          fl[i][p] = true;
        }
        half.push_back({i,p}), g.push_back({i,p});
        p = row[i].next(p+1);
      }
    }
    for (auto [i,j] : half) if (row[i].has(j))
      row[i].remove(j), col[j].remove(i);
    for (auto [i,j] : half) {
      int bound = k - (fl[i][j]?0:1);
      int p = col[j].next(max(0,i-bound));
      while (p < n && p <= i+bound) {
        d[p][j] = x+1;
        g.push_back({p,j});
        row[p].remove(j), col[j].remove(p);
        p = col[j].next(p+1);
      }
    }
    swap(f,g);
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 5 ms 1492 KB Output is correct
20 Correct 10 ms 6848 KB Output is correct
21 Correct 3 ms 2004 KB Output is correct
22 Correct 7 ms 1568 KB Output is correct
23 Correct 5 ms 1484 KB Output is correct
24 Correct 10 ms 8896 KB Output is correct
25 Correct 13 ms 8896 KB Output is correct
26 Correct 1 ms 1492 KB Output is correct
27 Correct 1 ms 1484 KB Output is correct
28 Correct 3 ms 1492 KB Output is correct
29 Correct 16 ms 3184 KB Output is correct
30 Correct 10 ms 5048 KB Output is correct
31 Correct 10 ms 5252 KB Output is correct
32 Correct 19 ms 3276 KB Output is correct
33 Correct 14 ms 3196 KB Output is correct
34 Correct 29 ms 25776 KB Output is correct
35 Correct 38 ms 25780 KB Output is correct
36 Correct 11 ms 3724 KB Output is correct
37 Correct 16 ms 3404 KB Output is correct
38 Correct 2 ms 3148 KB Output is correct
39 Correct 241 ms 27676 KB Output is correct
40 Correct 8 ms 4552 KB Output is correct
41 Correct 32 ms 26628 KB Output is correct
42 Correct 25 ms 4284 KB Output is correct
43 Correct 36 ms 19228 KB Output is correct
44 Correct 49 ms 26548 KB Output is correct
45 Correct 62 ms 32072 KB Output is correct
46 Correct 40 ms 31756 KB Output is correct
47 Correct 247 ms 28104 KB Output is correct
48 Correct 192 ms 27628 KB Output is correct
49 Correct 286 ms 214740 KB Output is correct
50 Correct 329 ms 214772 KB Output is correct
51 Correct 178 ms 30512 KB Output is correct
52 Correct 140 ms 28284 KB Output is correct
53 Correct 177 ms 27912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 0 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 0 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 368 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 320 KB Output is correct
25 Correct 1 ms 1108 KB Output is correct
26 Correct 3 ms 1752 KB Output is correct
27 Correct 3 ms 2128 KB Output is correct
28 Correct 2 ms 2004 KB Output is correct
29 Correct 4 ms 2128 KB Output is correct
30 Correct 3 ms 2004 KB Output is correct
31 Correct 5 ms 2776 KB Output is correct
32 Correct 1 ms 1428 KB Output is correct
33 Correct 1 ms 1436 KB Output is correct
34 Correct 5 ms 3648 KB Output is correct
35 Correct 7 ms 5312 KB Output is correct
36 Correct 7 ms 4308 KB Output is correct
37 Correct 7 ms 5308 KB Output is correct
38 Correct 6 ms 5308 KB Output is correct
39 Correct 19 ms 10508 KB Output is correct
40 Correct 64 ms 32848 KB Output is correct
41 Correct 36 ms 31712 KB Output is correct
42 Correct 101 ms 44020 KB Output is correct
43 Correct 84 ms 44180 KB Output is correct
44 Correct 80 ms 44092 KB Output is correct
45 Correct 63 ms 37888 KB Output is correct
46 Correct 58 ms 36924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 0 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 0 ms 320 KB Output is correct
33 Correct 5 ms 1492 KB Output is correct
34 Correct 1 ms 316 KB Output is correct
35 Correct 1 ms 732 KB Output is correct
36 Correct 2 ms 1136 KB Output is correct
37 Correct 10 ms 6848 KB Output is correct
38 Correct 3 ms 1752 KB Output is correct
39 Correct 3 ms 2004 KB Output is correct
40 Correct 7 ms 1480 KB Output is correct
41 Correct 5 ms 1492 KB Output is correct
42 Correct 3 ms 2120 KB Output is correct
43 Correct 3 ms 2128 KB Output is correct
44 Correct 3 ms 2004 KB Output is correct
45 Correct 10 ms 8888 KB Output is correct
46 Correct 12 ms 8896 KB Output is correct
47 Correct 10 ms 4980 KB Output is correct
48 Correct 8 ms 1988 KB Output is correct
49 Correct 7 ms 1872 KB Output is correct
50 Correct 13 ms 2212 KB Output is correct
51 Correct 5 ms 2704 KB Output is correct
52 Correct 1 ms 1484 KB Output is correct
53 Correct 1 ms 1492 KB Output is correct
54 Correct 3 ms 1480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 0 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 0 ms 320 KB Output is correct
33 Correct 5 ms 1492 KB Output is correct
34 Correct 1 ms 316 KB Output is correct
35 Correct 1 ms 732 KB Output is correct
36 Correct 2 ms 1136 KB Output is correct
37 Correct 10 ms 6848 KB Output is correct
38 Correct 3 ms 1752 KB Output is correct
39 Correct 3 ms 2004 KB Output is correct
40 Correct 7 ms 1480 KB Output is correct
41 Correct 5 ms 1492 KB Output is correct
42 Correct 3 ms 2120 KB Output is correct
43 Correct 3 ms 2128 KB Output is correct
44 Correct 3 ms 2004 KB Output is correct
45 Correct 10 ms 8888 KB Output is correct
46 Correct 12 ms 8896 KB Output is correct
47 Correct 10 ms 4980 KB Output is correct
48 Correct 8 ms 1988 KB Output is correct
49 Correct 7 ms 1872 KB Output is correct
50 Correct 13 ms 2212 KB Output is correct
51 Correct 5 ms 2704 KB Output is correct
52 Correct 1 ms 1484 KB Output is correct
53 Correct 1 ms 1492 KB Output is correct
54 Correct 3 ms 1480 KB Output is correct
55 Correct 16 ms 3184 KB Output is correct
56 Correct 9 ms 5128 KB Output is correct
57 Correct 7 ms 3680 KB Output is correct
58 Correct 18 ms 3884 KB Output is correct
59 Correct 7 ms 5308 KB Output is correct
60 Correct 19 ms 3260 KB Output is correct
61 Correct 13 ms 3156 KB Output is correct
62 Correct 6 ms 4308 KB Output is correct
63 Correct 7 ms 5340 KB Output is correct
64 Correct 6 ms 5320 KB Output is correct
65 Correct 28 ms 25796 KB Output is correct
66 Correct 40 ms 25820 KB Output is correct
67 Correct 29 ms 13556 KB Output is correct
68 Correct 26 ms 4008 KB Output is correct
69 Correct 30 ms 3972 KB Output is correct
70 Correct 18 ms 3920 KB Output is correct
71 Correct 28 ms 6228 KB Output is correct
72 Correct 11 ms 3708 KB Output is correct
73 Correct 16 ms 3492 KB Output is correct
74 Correct 2 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 5 ms 1492 KB Output is correct
20 Correct 10 ms 6848 KB Output is correct
21 Correct 3 ms 2004 KB Output is correct
22 Correct 7 ms 1568 KB Output is correct
23 Correct 5 ms 1484 KB Output is correct
24 Correct 10 ms 8896 KB Output is correct
25 Correct 13 ms 8896 KB Output is correct
26 Correct 1 ms 1492 KB Output is correct
27 Correct 1 ms 1484 KB Output is correct
28 Correct 3 ms 1492 KB Output is correct
29 Correct 16 ms 3184 KB Output is correct
30 Correct 10 ms 5048 KB Output is correct
31 Correct 10 ms 5252 KB Output is correct
32 Correct 19 ms 3276 KB Output is correct
33 Correct 14 ms 3196 KB Output is correct
34 Correct 29 ms 25776 KB Output is correct
35 Correct 38 ms 25780 KB Output is correct
36 Correct 11 ms 3724 KB Output is correct
37 Correct 16 ms 3404 KB Output is correct
38 Correct 2 ms 3148 KB Output is correct
39 Correct 241 ms 27676 KB Output is correct
40 Correct 8 ms 4552 KB Output is correct
41 Correct 32 ms 26628 KB Output is correct
42 Correct 25 ms 4284 KB Output is correct
43 Correct 36 ms 19228 KB Output is correct
44 Correct 49 ms 26548 KB Output is correct
45 Correct 62 ms 32072 KB Output is correct
46 Correct 40 ms 31756 KB Output is correct
47 Correct 247 ms 28104 KB Output is correct
48 Correct 192 ms 27628 KB Output is correct
49 Correct 286 ms 214740 KB Output is correct
50 Correct 329 ms 214772 KB Output is correct
51 Correct 178 ms 30512 KB Output is correct
52 Correct 140 ms 28284 KB Output is correct
53 Correct 177 ms 27912 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 0 ms 320 KB Output is correct
56 Correct 0 ms 316 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 0 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 0 ms 340 KB Output is correct
66 Correct 0 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 468 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 340 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 0 ms 340 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 0 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 0 ms 212 KB Output is correct
78 Correct 1 ms 316 KB Output is correct
79 Correct 0 ms 340 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 0 ms 340 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 0 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 0 ms 320 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 336 KB Output is correct
88 Correct 0 ms 324 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 1 ms 212 KB Output is correct
92 Correct 1 ms 368 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 0 ms 340 KB Output is correct
95 Correct 0 ms 340 KB Output is correct
96 Correct 1 ms 320 KB Output is correct
97 Correct 1 ms 468 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 1 ms 324 KB Output is correct
100 Correct 0 ms 320 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 1 ms 340 KB Output is correct
106 Correct 0 ms 340 KB Output is correct
107 Correct 0 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 320 KB Output is correct
110 Correct 1 ms 1108 KB Output is correct
111 Correct 3 ms 1752 KB Output is correct
112 Correct 3 ms 2128 KB Output is correct
113 Correct 2 ms 2004 KB Output is correct
114 Correct 4 ms 2128 KB Output is correct
115 Correct 3 ms 2004 KB Output is correct
116 Correct 5 ms 2776 KB Output is correct
117 Correct 1 ms 1428 KB Output is correct
118 Correct 1 ms 1436 KB Output is correct
119 Correct 5 ms 3648 KB Output is correct
120 Correct 7 ms 5312 KB Output is correct
121 Correct 7 ms 4308 KB Output is correct
122 Correct 7 ms 5308 KB Output is correct
123 Correct 6 ms 5308 KB Output is correct
124 Correct 19 ms 10508 KB Output is correct
125 Correct 64 ms 32848 KB Output is correct
126 Correct 36 ms 31712 KB Output is correct
127 Correct 101 ms 44020 KB Output is correct
128 Correct 84 ms 44180 KB Output is correct
129 Correct 80 ms 44092 KB Output is correct
130 Correct 63 ms 37888 KB Output is correct
131 Correct 58 ms 36924 KB Output is correct
132 Correct 5 ms 1492 KB Output is correct
133 Correct 1 ms 316 KB Output is correct
134 Correct 1 ms 732 KB Output is correct
135 Correct 2 ms 1136 KB Output is correct
136 Correct 10 ms 6848 KB Output is correct
137 Correct 3 ms 1752 KB Output is correct
138 Correct 3 ms 2004 KB Output is correct
139 Correct 7 ms 1480 KB Output is correct
140 Correct 5 ms 1492 KB Output is correct
141 Correct 3 ms 2120 KB Output is correct
142 Correct 3 ms 2128 KB Output is correct
143 Correct 3 ms 2004 KB Output is correct
144 Correct 10 ms 8888 KB Output is correct
145 Correct 12 ms 8896 KB Output is correct
146 Correct 10 ms 4980 KB Output is correct
147 Correct 8 ms 1988 KB Output is correct
148 Correct 7 ms 1872 KB Output is correct
149 Correct 13 ms 2212 KB Output is correct
150 Correct 5 ms 2704 KB Output is correct
151 Correct 1 ms 1484 KB Output is correct
152 Correct 1 ms 1492 KB Output is correct
153 Correct 3 ms 1480 KB Output is correct
154 Correct 16 ms 3184 KB Output is correct
155 Correct 9 ms 5128 KB Output is correct
156 Correct 7 ms 3680 KB Output is correct
157 Correct 18 ms 3884 KB Output is correct
158 Correct 7 ms 5308 KB Output is correct
159 Correct 19 ms 3260 KB Output is correct
160 Correct 13 ms 3156 KB Output is correct
161 Correct 6 ms 4308 KB Output is correct
162 Correct 7 ms 5340 KB Output is correct
163 Correct 6 ms 5320 KB Output is correct
164 Correct 28 ms 25796 KB Output is correct
165 Correct 40 ms 25820 KB Output is correct
166 Correct 29 ms 13556 KB Output is correct
167 Correct 26 ms 4008 KB Output is correct
168 Correct 30 ms 3972 KB Output is correct
169 Correct 18 ms 3920 KB Output is correct
170 Correct 28 ms 6228 KB Output is correct
171 Correct 11 ms 3708 KB Output is correct
172 Correct 16 ms 3492 KB Output is correct
173 Correct 2 ms 3156 KB Output is correct
174 Correct 9 ms 5448 KB Output is correct
175 Correct 73 ms 7656 KB Output is correct
176 Correct 71 ms 43656 KB Output is correct
177 Correct 117 ms 23040 KB Output is correct
178 Correct 32 ms 27660 KB Output is correct
179 Correct 181 ms 31660 KB Output is correct
180 Correct 341 ms 33644 KB Output is correct
181 Correct 339 ms 41256 KB Output is correct
182 Correct 357 ms 54840 KB Output is correct
183 Correct 172 ms 38560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 5 ms 1492 KB Output is correct
20 Correct 10 ms 6848 KB Output is correct
21 Correct 3 ms 2004 KB Output is correct
22 Correct 7 ms 1568 KB Output is correct
23 Correct 5 ms 1484 KB Output is correct
24 Correct 10 ms 8896 KB Output is correct
25 Correct 13 ms 8896 KB Output is correct
26 Correct 1 ms 1492 KB Output is correct
27 Correct 1 ms 1484 KB Output is correct
28 Correct 3 ms 1492 KB Output is correct
29 Correct 16 ms 3184 KB Output is correct
30 Correct 10 ms 5048 KB Output is correct
31 Correct 10 ms 5252 KB Output is correct
32 Correct 19 ms 3276 KB Output is correct
33 Correct 14 ms 3196 KB Output is correct
34 Correct 29 ms 25776 KB Output is correct
35 Correct 38 ms 25780 KB Output is correct
36 Correct 11 ms 3724 KB Output is correct
37 Correct 16 ms 3404 KB Output is correct
38 Correct 2 ms 3148 KB Output is correct
39 Correct 241 ms 27676 KB Output is correct
40 Correct 8 ms 4552 KB Output is correct
41 Correct 32 ms 26628 KB Output is correct
42 Correct 25 ms 4284 KB Output is correct
43 Correct 36 ms 19228 KB Output is correct
44 Correct 49 ms 26548 KB Output is correct
45 Correct 62 ms 32072 KB Output is correct
46 Correct 40 ms 31756 KB Output is correct
47 Correct 247 ms 28104 KB Output is correct
48 Correct 192 ms 27628 KB Output is correct
49 Correct 286 ms 214740 KB Output is correct
50 Correct 329 ms 214772 KB Output is correct
51 Correct 178 ms 30512 KB Output is correct
52 Correct 140 ms 28284 KB Output is correct
53 Correct 177 ms 27912 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 0 ms 320 KB Output is correct
56 Correct 0 ms 316 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 0 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 0 ms 340 KB Output is correct
66 Correct 0 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 468 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 340 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 0 ms 340 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 0 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 0 ms 212 KB Output is correct
78 Correct 1 ms 316 KB Output is correct
79 Correct 0 ms 340 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 0 ms 340 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 0 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 0 ms 320 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 336 KB Output is correct
88 Correct 0 ms 324 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 1 ms 212 KB Output is correct
92 Correct 1 ms 368 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 0 ms 340 KB Output is correct
95 Correct 0 ms 340 KB Output is correct
96 Correct 1 ms 320 KB Output is correct
97 Correct 1 ms 468 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 1 ms 324 KB Output is correct
100 Correct 0 ms 320 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 1 ms 340 KB Output is correct
106 Correct 0 ms 340 KB Output is correct
107 Correct 0 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 320 KB Output is correct
110 Correct 1 ms 1108 KB Output is correct
111 Correct 3 ms 1752 KB Output is correct
112 Correct 3 ms 2128 KB Output is correct
113 Correct 2 ms 2004 KB Output is correct
114 Correct 4 ms 2128 KB Output is correct
115 Correct 3 ms 2004 KB Output is correct
116 Correct 5 ms 2776 KB Output is correct
117 Correct 1 ms 1428 KB Output is correct
118 Correct 1 ms 1436 KB Output is correct
119 Correct 5 ms 3648 KB Output is correct
120 Correct 7 ms 5312 KB Output is correct
121 Correct 7 ms 4308 KB Output is correct
122 Correct 7 ms 5308 KB Output is correct
123 Correct 6 ms 5308 KB Output is correct
124 Correct 19 ms 10508 KB Output is correct
125 Correct 64 ms 32848 KB Output is correct
126 Correct 36 ms 31712 KB Output is correct
127 Correct 101 ms 44020 KB Output is correct
128 Correct 84 ms 44180 KB Output is correct
129 Correct 80 ms 44092 KB Output is correct
130 Correct 63 ms 37888 KB Output is correct
131 Correct 58 ms 36924 KB Output is correct
132 Correct 5 ms 1492 KB Output is correct
133 Correct 1 ms 316 KB Output is correct
134 Correct 1 ms 732 KB Output is correct
135 Correct 2 ms 1136 KB Output is correct
136 Correct 10 ms 6848 KB Output is correct
137 Correct 3 ms 1752 KB Output is correct
138 Correct 3 ms 2004 KB Output is correct
139 Correct 7 ms 1480 KB Output is correct
140 Correct 5 ms 1492 KB Output is correct
141 Correct 3 ms 2120 KB Output is correct
142 Correct 3 ms 2128 KB Output is correct
143 Correct 3 ms 2004 KB Output is correct
144 Correct 10 ms 8888 KB Output is correct
145 Correct 12 ms 8896 KB Output is correct
146 Correct 10 ms 4980 KB Output is correct
147 Correct 8 ms 1988 KB Output is correct
148 Correct 7 ms 1872 KB Output is correct
149 Correct 13 ms 2212 KB Output is correct
150 Correct 5 ms 2704 KB Output is correct
151 Correct 1 ms 1484 KB Output is correct
152 Correct 1 ms 1492 KB Output is correct
153 Correct 3 ms 1480 KB Output is correct
154 Correct 16 ms 3184 KB Output is correct
155 Correct 9 ms 5128 KB Output is correct
156 Correct 7 ms 3680 KB Output is correct
157 Correct 18 ms 3884 KB Output is correct
158 Correct 7 ms 5308 KB Output is correct
159 Correct 19 ms 3260 KB Output is correct
160 Correct 13 ms 3156 KB Output is correct
161 Correct 6 ms 4308 KB Output is correct
162 Correct 7 ms 5340 KB Output is correct
163 Correct 6 ms 5320 KB Output is correct
164 Correct 28 ms 25796 KB Output is correct
165 Correct 40 ms 25820 KB Output is correct
166 Correct 29 ms 13556 KB Output is correct
167 Correct 26 ms 4008 KB Output is correct
168 Correct 30 ms 3972 KB Output is correct
169 Correct 18 ms 3920 KB Output is correct
170 Correct 28 ms 6228 KB Output is correct
171 Correct 11 ms 3708 KB Output is correct
172 Correct 16 ms 3492 KB Output is correct
173 Correct 2 ms 3156 KB Output is correct
174 Correct 9 ms 5448 KB Output is correct
175 Correct 73 ms 7656 KB Output is correct
176 Correct 71 ms 43656 KB Output is correct
177 Correct 117 ms 23040 KB Output is correct
178 Correct 32 ms 27660 KB Output is correct
179 Correct 181 ms 31660 KB Output is correct
180 Correct 341 ms 33644 KB Output is correct
181 Correct 339 ms 41256 KB Output is correct
182 Correct 357 ms 54840 KB Output is correct
183 Correct 172 ms 38560 KB Output is correct
184 Correct 564 ms 54848 KB Output is correct
185 Correct 91 ms 35140 KB Output is correct
186 Correct 78 ms 40828 KB Output is correct
187 Correct 47 ms 44948 KB Output is correct
188 Correct 227 ms 87508 KB Output is correct
189 Correct 420 ms 55612 KB Output is correct
190 Correct 185 ms 54740 KB Output is correct
191 Correct 244 ms 87520 KB Output is correct
192 Correct 221 ms 87648 KB Output is correct
193 Correct 163 ms 87632 KB Output is correct
194 Correct 610 ms 429228 KB Output is correct
195 Correct 678 ms 429228 KB Output is correct
196 Correct 429 ms 61524 KB Output is correct
197 Correct 245 ms 63560 KB Output is correct
198 Correct 445 ms 72940 KB Output is correct
199 Correct 392 ms 66004 KB Output is correct
200 Correct 206 ms 57948 KB Output is correct
201 Correct 352 ms 56168 KB Output is correct
202 Correct 448 ms 55068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 5 ms 1492 KB Output is correct
20 Correct 10 ms 6848 KB Output is correct
21 Correct 3 ms 2004 KB Output is correct
22 Correct 7 ms 1568 KB Output is correct
23 Correct 5 ms 1484 KB Output is correct
24 Correct 10 ms 8896 KB Output is correct
25 Correct 13 ms 8896 KB Output is correct
26 Correct 1 ms 1492 KB Output is correct
27 Correct 1 ms 1484 KB Output is correct
28 Correct 3 ms 1492 KB Output is correct
29 Correct 16 ms 3184 KB Output is correct
30 Correct 10 ms 5048 KB Output is correct
31 Correct 10 ms 5252 KB Output is correct
32 Correct 19 ms 3276 KB Output is correct
33 Correct 14 ms 3196 KB Output is correct
34 Correct 29 ms 25776 KB Output is correct
35 Correct 38 ms 25780 KB Output is correct
36 Correct 11 ms 3724 KB Output is correct
37 Correct 16 ms 3404 KB Output is correct
38 Correct 2 ms 3148 KB Output is correct
39 Correct 241 ms 27676 KB Output is correct
40 Correct 8 ms 4552 KB Output is correct
41 Correct 32 ms 26628 KB Output is correct
42 Correct 25 ms 4284 KB Output is correct
43 Correct 36 ms 19228 KB Output is correct
44 Correct 49 ms 26548 KB Output is correct
45 Correct 62 ms 32072 KB Output is correct
46 Correct 40 ms 31756 KB Output is correct
47 Correct 247 ms 28104 KB Output is correct
48 Correct 192 ms 27628 KB Output is correct
49 Correct 286 ms 214740 KB Output is correct
50 Correct 329 ms 214772 KB Output is correct
51 Correct 178 ms 30512 KB Output is correct
52 Correct 140 ms 28284 KB Output is correct
53 Correct 177 ms 27912 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 0 ms 320 KB Output is correct
56 Correct 0 ms 316 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 0 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 0 ms 340 KB Output is correct
66 Correct 0 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 468 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 340 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 0 ms 340 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 0 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 0 ms 212 KB Output is correct
78 Correct 1 ms 316 KB Output is correct
79 Correct 0 ms 340 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 0 ms 340 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 0 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 0 ms 320 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 336 KB Output is correct
88 Correct 0 ms 324 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 1 ms 212 KB Output is correct
92 Correct 1 ms 368 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 0 ms 340 KB Output is correct
95 Correct 0 ms 340 KB Output is correct
96 Correct 1 ms 320 KB Output is correct
97 Correct 1 ms 468 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 1 ms 324 KB Output is correct
100 Correct 0 ms 320 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 1 ms 340 KB Output is correct
106 Correct 0 ms 340 KB Output is correct
107 Correct 0 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 320 KB Output is correct
110 Correct 1 ms 1108 KB Output is correct
111 Correct 3 ms 1752 KB Output is correct
112 Correct 3 ms 2128 KB Output is correct
113 Correct 2 ms 2004 KB Output is correct
114 Correct 4 ms 2128 KB Output is correct
115 Correct 3 ms 2004 KB Output is correct
116 Correct 5 ms 2776 KB Output is correct
117 Correct 1 ms 1428 KB Output is correct
118 Correct 1 ms 1436 KB Output is correct
119 Correct 5 ms 3648 KB Output is correct
120 Correct 7 ms 5312 KB Output is correct
121 Correct 7 ms 4308 KB Output is correct
122 Correct 7 ms 5308 KB Output is correct
123 Correct 6 ms 5308 KB Output is correct
124 Correct 19 ms 10508 KB Output is correct
125 Correct 64 ms 32848 KB Output is correct
126 Correct 36 ms 31712 KB Output is correct
127 Correct 101 ms 44020 KB Output is correct
128 Correct 84 ms 44180 KB Output is correct
129 Correct 80 ms 44092 KB Output is correct
130 Correct 63 ms 37888 KB Output is correct
131 Correct 58 ms 36924 KB Output is correct
132 Correct 5 ms 1492 KB Output is correct
133 Correct 1 ms 316 KB Output is correct
134 Correct 1 ms 732 KB Output is correct
135 Correct 2 ms 1136 KB Output is correct
136 Correct 10 ms 6848 KB Output is correct
137 Correct 3 ms 1752 KB Output is correct
138 Correct 3 ms 2004 KB Output is correct
139 Correct 7 ms 1480 KB Output is correct
140 Correct 5 ms 1492 KB Output is correct
141 Correct 3 ms 2120 KB Output is correct
142 Correct 3 ms 2128 KB Output is correct
143 Correct 3 ms 2004 KB Output is correct
144 Correct 10 ms 8888 KB Output is correct
145 Correct 12 ms 8896 KB Output is correct
146 Correct 10 ms 4980 KB Output is correct
147 Correct 8 ms 1988 KB Output is correct
148 Correct 7 ms 1872 KB Output is correct
149 Correct 13 ms 2212 KB Output is correct
150 Correct 5 ms 2704 KB Output is correct
151 Correct 1 ms 1484 KB Output is correct
152 Correct 1 ms 1492 KB Output is correct
153 Correct 3 ms 1480 KB Output is correct
154 Correct 16 ms 3184 KB Output is correct
155 Correct 9 ms 5128 KB Output is correct
156 Correct 7 ms 3680 KB Output is correct
157 Correct 18 ms 3884 KB Output is correct
158 Correct 7 ms 5308 KB Output is correct
159 Correct 19 ms 3260 KB Output is correct
160 Correct 13 ms 3156 KB Output is correct
161 Correct 6 ms 4308 KB Output is correct
162 Correct 7 ms 5340 KB Output is correct
163 Correct 6 ms 5320 KB Output is correct
164 Correct 28 ms 25796 KB Output is correct
165 Correct 40 ms 25820 KB Output is correct
166 Correct 29 ms 13556 KB Output is correct
167 Correct 26 ms 4008 KB Output is correct
168 Correct 30 ms 3972 KB Output is correct
169 Correct 18 ms 3920 KB Output is correct
170 Correct 28 ms 6228 KB Output is correct
171 Correct 11 ms 3708 KB Output is correct
172 Correct 16 ms 3492 KB Output is correct
173 Correct 2 ms 3156 KB Output is correct
174 Correct 9 ms 5448 KB Output is correct
175 Correct 73 ms 7656 KB Output is correct
176 Correct 71 ms 43656 KB Output is correct
177 Correct 117 ms 23040 KB Output is correct
178 Correct 32 ms 27660 KB Output is correct
179 Correct 181 ms 31660 KB Output is correct
180 Correct 341 ms 33644 KB Output is correct
181 Correct 339 ms 41256 KB Output is correct
182 Correct 357 ms 54840 KB Output is correct
183 Correct 172 ms 38560 KB Output is correct
184 Correct 564 ms 54848 KB Output is correct
185 Correct 91 ms 35140 KB Output is correct
186 Correct 78 ms 40828 KB Output is correct
187 Correct 47 ms 44948 KB Output is correct
188 Correct 227 ms 87508 KB Output is correct
189 Correct 420 ms 55612 KB Output is correct
190 Correct 185 ms 54740 KB Output is correct
191 Correct 244 ms 87520 KB Output is correct
192 Correct 221 ms 87648 KB Output is correct
193 Correct 163 ms 87632 KB Output is correct
194 Correct 610 ms 429228 KB Output is correct
195 Correct 678 ms 429228 KB Output is correct
196 Correct 429 ms 61524 KB Output is correct
197 Correct 245 ms 63560 KB Output is correct
198 Correct 445 ms 72940 KB Output is correct
199 Correct 392 ms 66004 KB Output is correct
200 Correct 206 ms 57948 KB Output is correct
201 Correct 352 ms 56168 KB Output is correct
202 Correct 448 ms 55068 KB Output is correct
203 Correct 1115 ms 108948 KB Output is correct
204 Correct 620 ms 160024 KB Output is correct
205 Correct 546 ms 69372 KB Output is correct
206 Correct 200 ms 126032 KB Output is correct
207 Correct 495 ms 174500 KB Output is correct
208 Correct 976 ms 109420 KB Output is correct
209 Correct 1125 ms 108892 KB Output is correct
210 Correct 301 ms 141660 KB Output is correct
211 Correct 384 ms 174596 KB Output is correct
212 Correct 394 ms 174608 KB Output is correct
213 Correct 1093 ms 858136 KB Output is correct
214 Correct 1428 ms 858184 KB Output is correct
215 Correct 1279 ms 120288 KB Output is correct
216 Correct 1581 ms 125448 KB Output is correct
217 Execution timed out 2054 ms 142604 KB Time limit exceeded
218 Halted 0 ms 0 KB -