Submission #1051888

# Submission time Handle Problem Language Result Execution time Memory
1051888 2024-08-10T10:25:47 Z MilosMilutinovic Brought Down the Grading Server? (CEOI23_balance) C++14
100 / 100
669 ms 143696 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int) (1e6) + 100;

int ptr[N], from[N], to[N];
vector<int> g[N];
vector<int> euler;
bool was[N];

void dfs(int v) {
  while (ptr[v] < (int) g[v].size()) {
    int e = g[v][ptr[v]];
    if (was[e]) {
      ptr[v] += 1;
      continue;
    }
    int u = (from[e] ^ to[e] ^ v);
    was[e] = true;
    dfs(u);
    ptr[v] += 1;
  }
  euler.push_back(v);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, s, t;
  cin >> n >> s >> t;
  vector<vector<int>> a(n, vector<int>(s));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s; j++) {
      cin >> a[i][j];
      --a[i][j];
    }
  }
  /* for (int i = 0; i < n; i++) {
    for (int j = 0; j < s; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  cout << "t = " << t << endl; */
  vector<vector<int>> res(n, vector<int>(s, -1));
  function<void(int, int, vector<vector<int>>)> Solve = [&](int l, int r, vector<vector<int>> a) {
    if (l == r) {
      for (int i = 0; i < n; i++) {
        res[i][l] = a[i][0];
      }
      return;
    }
    int m = r - l + 1; 
    vector<vector<int>> pos(t);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        pos[a[i][j]].push_back(i);
      }
    }
    for (int i = 0; i < n + 1 + t; i++) {
      g[i].clear();
      ptr[i] = 0;
    }
    int p = 0;
    for (int i = 0; i < t; i++) {
      if ((int) pos[i].size() % 2 == 1) {
        from[p] = n;
        to[p] = n + 1 + i;
        g[n].push_back(p);
        g[n + 1 + i].push_back(p);
        p += 1;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        from[p] = i;
        to[p] = n + 1 + a[i][j];
        g[i].push_back(p);
        g[n + 1 + a[i][j]].push_back(p);
        p += 1;
      }
    }
    for (int i = 0; i < p; i++) {
      was[i] = false;
    }
    vector<vector<int>> L(n);
    vector<vector<int>> R(n);
    for (int i = 0; i < n + 1; i++) {
      if (ptr[i] < (int) g[i].size()) {
        euler.clear();
        dfs(i);
        int sz = (int) euler.size();
        for (int i = 0; i < sz; i += 2) {
          if (euler[i] == n) {
            continue;
          }
          if (i + 1 < sz) {
            L[euler[i]].push_back(euler[i + 1] - n - 1);
          }
          if (i > 0) {
            R[euler[i]].push_back(euler[i - 1] - n - 1);
          }
        }
      }
    }
    /* if (l == 0 && r == 1) {
      cout << "euler = ";
      for (int i : euler) {
        cout << i << " ";
      }
      cout << endl;
    } */
    /* if (l == 0 && r == s - 1) {
      cout << "L" << endl;
      for (int i = 0; i < n; i++) {
        for (int v : L[i]) {
          cout << v << " ";
        }
        cout << endl;
      }
      cout << "R" << endl;
      for (int i = 0; i < n; i++) {
        for (int v : L[i]) {
          cout << v << " ";
        }
        cout << endl;
      } 
    } */
    int mid = (l + r) >> 1;
    Solve(l, mid, L);
    Solve(mid + 1, r, R);
  };
  Solve(0, s - 1, a);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s; j++) {
      cout << res[i][j] + 1 << " ";
    }
    cout << '\n';
  }
  return 0; 
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 29016 KB Correct
2 Correct 5 ms 29020 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 29020 KB Correct
2 Correct 5 ms 29020 KB Correct
3 Correct 4 ms 29200 KB Correct
4 Correct 5 ms 29016 KB Correct
5 Correct 4 ms 29020 KB Correct
6 Correct 4 ms 29020 KB Correct
7 Correct 3 ms 29196 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 91332 KB Correct
2 Correct 148 ms 90364 KB Correct
3 Correct 97 ms 80584 KB Correct
4 Correct 79 ms 84164 KB Correct
5 Correct 118 ms 90288 KB Correct
6 Correct 114 ms 92560 KB Correct
7 Correct 117 ms 79716 KB Correct
8 Correct 107 ms 93388 KB Correct
9 Correct 81 ms 93124 KB Correct
10 Correct 104 ms 93416 KB Correct
11 Correct 80 ms 93128 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 91332 KB Correct
2 Correct 148 ms 90364 KB Correct
3 Correct 97 ms 80584 KB Correct
4 Correct 79 ms 84164 KB Correct
5 Correct 118 ms 90288 KB Correct
6 Correct 114 ms 92560 KB Correct
7 Correct 117 ms 79716 KB Correct
8 Correct 107 ms 93388 KB Correct
9 Correct 81 ms 93124 KB Correct
10 Correct 104 ms 93416 KB Correct
11 Correct 80 ms 93128 KB Correct
12 Correct 124 ms 91336 KB Correct
13 Correct 102 ms 90444 KB Correct
14 Correct 113 ms 80752 KB Correct
15 Correct 95 ms 84164 KB Correct
16 Correct 108 ms 90304 KB Correct
17 Correct 115 ms 92532 KB Correct
18 Correct 165 ms 79816 KB Correct
19 Correct 98 ms 93388 KB Correct
20 Correct 108 ms 93116 KB Correct
21 Correct 111 ms 93388 KB Correct
22 Correct 92 ms 93124 KB Correct
23 Correct 138 ms 96228 KB Correct
24 Correct 113 ms 84560 KB Correct
25 Correct 123 ms 88960 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 29020 KB Correct
2 Correct 5 ms 29020 KB Correct
3 Correct 4 ms 29200 KB Correct
4 Correct 5 ms 29016 KB Correct
5 Correct 4 ms 29020 KB Correct
6 Correct 4 ms 29020 KB Correct
7 Correct 3 ms 29196 KB Correct
8 Correct 129 ms 91332 KB Correct
9 Correct 148 ms 90364 KB Correct
10 Correct 97 ms 80584 KB Correct
11 Correct 79 ms 84164 KB Correct
12 Correct 118 ms 90288 KB Correct
13 Correct 114 ms 92560 KB Correct
14 Correct 117 ms 79716 KB Correct
15 Correct 107 ms 93388 KB Correct
16 Correct 81 ms 93124 KB Correct
17 Correct 104 ms 93416 KB Correct
18 Correct 80 ms 93128 KB Correct
19 Correct 124 ms 91336 KB Correct
20 Correct 102 ms 90444 KB Correct
21 Correct 113 ms 80752 KB Correct
22 Correct 95 ms 84164 KB Correct
23 Correct 108 ms 90304 KB Correct
24 Correct 115 ms 92532 KB Correct
25 Correct 165 ms 79816 KB Correct
26 Correct 98 ms 93388 KB Correct
27 Correct 108 ms 93116 KB Correct
28 Correct 111 ms 93388 KB Correct
29 Correct 92 ms 93124 KB Correct
30 Correct 138 ms 96228 KB Correct
31 Correct 113 ms 84560 KB Correct
32 Correct 123 ms 88960 KB Correct
33 Correct 3 ms 29020 KB Correct
34 Correct 5 ms 29020 KB Correct
35 Correct 4 ms 29016 KB Correct
36 Correct 5 ms 29272 KB Correct
37 Correct 4 ms 29020 KB Correct
38 Correct 3 ms 29016 KB Correct
39 Correct 4 ms 29020 KB Correct
40 Correct 146 ms 92308 KB Correct
41 Correct 155 ms 91580 KB Correct
42 Correct 114 ms 81576 KB Correct
43 Correct 83 ms 84680 KB Correct
44 Correct 105 ms 91468 KB Correct
45 Correct 143 ms 93640 KB Correct
46 Correct 123 ms 80980 KB Correct
47 Correct 88 ms 94408 KB Correct
48 Correct 86 ms 94336 KB Correct
49 Correct 76 ms 94408 KB Correct
50 Correct 77 ms 94288 KB Correct
51 Correct 138 ms 97224 KB Correct
52 Correct 94 ms 84424 KB Correct
53 Correct 99 ms 89036 KB Correct
54 Correct 82 ms 67892 KB Correct
55 Correct 5 ms 31836 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 29020 KB Correct
2 Correct 12 ms 30392 KB Correct
3 Correct 8 ms 30200 KB Correct
4 Correct 11 ms 31420 KB Correct
5 Correct 6 ms 31580 KB Correct
6 Correct 7 ms 31928 KB Correct
7 Correct 11 ms 31480 KB Correct
8 Correct 9 ms 31064 KB Correct
9 Correct 8 ms 30812 KB Correct
10 Correct 11 ms 31320 KB Correct
11 Correct 7 ms 31068 KB Correct
12 Correct 7 ms 31948 KB Correct
13 Correct 11 ms 32040 KB Correct
14 Correct 7 ms 32040 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 29020 KB Correct
2 Correct 12 ms 30392 KB Correct
3 Correct 8 ms 30200 KB Correct
4 Correct 11 ms 31420 KB Correct
5 Correct 6 ms 31580 KB Correct
6 Correct 7 ms 31928 KB Correct
7 Correct 11 ms 31480 KB Correct
8 Correct 9 ms 31064 KB Correct
9 Correct 8 ms 30812 KB Correct
10 Correct 11 ms 31320 KB Correct
11 Correct 7 ms 31068 KB Correct
12 Correct 7 ms 31948 KB Correct
13 Correct 11 ms 32040 KB Correct
14 Correct 7 ms 32040 KB Correct
15 Correct 3 ms 29020 KB Correct
16 Correct 13 ms 30316 KB Correct
17 Correct 8 ms 30044 KB Correct
18 Correct 9 ms 31324 KB Correct
19 Correct 6 ms 31580 KB Correct
20 Correct 8 ms 31836 KB Correct
21 Correct 7 ms 31324 KB Correct
22 Correct 12 ms 31068 KB Correct
23 Correct 8 ms 30812 KB Correct
24 Correct 7 ms 31324 KB Correct
25 Correct 10 ms 31068 KB Correct
26 Correct 10 ms 31960 KB Correct
27 Correct 10 ms 32044 KB Correct
28 Correct 6 ms 32044 KB Correct
29 Correct 9 ms 30300 KB Correct
30 Correct 8 ms 31832 KB Correct
31 Correct 9 ms 31244 KB Correct
32 Correct 8 ms 31324 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 29020 KB Correct
2 Correct 12 ms 30392 KB Correct
3 Correct 8 ms 30200 KB Correct
4 Correct 11 ms 31420 KB Correct
5 Correct 6 ms 31580 KB Correct
6 Correct 7 ms 31928 KB Correct
7 Correct 11 ms 31480 KB Correct
8 Correct 9 ms 31064 KB Correct
9 Correct 8 ms 30812 KB Correct
10 Correct 11 ms 31320 KB Correct
11 Correct 7 ms 31068 KB Correct
12 Correct 7 ms 31948 KB Correct
13 Correct 11 ms 32040 KB Correct
14 Correct 7 ms 32040 KB Correct
15 Correct 3 ms 29020 KB Correct
16 Correct 13 ms 30316 KB Correct
17 Correct 8 ms 30044 KB Correct
18 Correct 9 ms 31324 KB Correct
19 Correct 6 ms 31580 KB Correct
20 Correct 8 ms 31836 KB Correct
21 Correct 7 ms 31324 KB Correct
22 Correct 12 ms 31068 KB Correct
23 Correct 8 ms 30812 KB Correct
24 Correct 7 ms 31324 KB Correct
25 Correct 10 ms 31068 KB Correct
26 Correct 10 ms 31960 KB Correct
27 Correct 10 ms 32044 KB Correct
28 Correct 6 ms 32044 KB Correct
29 Correct 9 ms 30300 KB Correct
30 Correct 8 ms 31832 KB Correct
31 Correct 9 ms 31244 KB Correct
32 Correct 8 ms 31324 KB Correct
33 Correct 5 ms 29020 KB Correct
34 Correct 11 ms 30300 KB Correct
35 Correct 8 ms 30044 KB Correct
36 Correct 8 ms 31324 KB Correct
37 Correct 9 ms 31784 KB Correct
38 Correct 7 ms 31984 KB Correct
39 Correct 11 ms 31324 KB Correct
40 Correct 8 ms 31068 KB Correct
41 Correct 8 ms 30812 KB Correct
42 Correct 8 ms 31428 KB Correct
43 Correct 11 ms 31068 KB Correct
44 Correct 11 ms 32092 KB Correct
45 Correct 7 ms 32092 KB Correct
46 Correct 11 ms 32068 KB Correct
47 Correct 12 ms 30472 KB Correct
48 Correct 8 ms 31580 KB Correct
49 Correct 12 ms 31380 KB Correct
50 Correct 8 ms 31460 KB Correct
51 Correct 5 ms 29020 KB Correct
52 Correct 3 ms 29112 KB Correct
53 Correct 3 ms 29016 KB Correct
54 Correct 4 ms 29020 KB Correct
55 Correct 4 ms 29020 KB Correct
56 Correct 4 ms 29020 KB Correct
57 Correct 3 ms 29020 KB Correct
58 Correct 88 ms 48416 KB Correct
59 Correct 658 ms 60252 KB Correct
60 Correct 14 ms 32228 KB Correct
61 Correct 22 ms 37980 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 91332 KB Correct
2 Correct 148 ms 90364 KB Correct
3 Correct 97 ms 80584 KB Correct
4 Correct 79 ms 84164 KB Correct
5 Correct 118 ms 90288 KB Correct
6 Correct 114 ms 92560 KB Correct
7 Correct 117 ms 79716 KB Correct
8 Correct 107 ms 93388 KB Correct
9 Correct 81 ms 93124 KB Correct
10 Correct 104 ms 93416 KB Correct
11 Correct 80 ms 93128 KB Correct
12 Correct 3 ms 29020 KB Correct
13 Correct 12 ms 30392 KB Correct
14 Correct 8 ms 30200 KB Correct
15 Correct 11 ms 31420 KB Correct
16 Correct 6 ms 31580 KB Correct
17 Correct 7 ms 31928 KB Correct
18 Correct 11 ms 31480 KB Correct
19 Correct 9 ms 31064 KB Correct
20 Correct 8 ms 30812 KB Correct
21 Correct 11 ms 31320 KB Correct
22 Correct 7 ms 31068 KB Correct
23 Correct 7 ms 31948 KB Correct
24 Correct 11 ms 32040 KB Correct
25 Correct 7 ms 32040 KB Correct
26 Correct 117 ms 91332 KB Correct
27 Correct 132 ms 90372 KB Correct
28 Correct 93 ms 80588 KB Correct
29 Correct 64 ms 84148 KB Correct
30 Correct 86 ms 90440 KB Correct
31 Correct 133 ms 92364 KB Correct
32 Correct 120 ms 79820 KB Correct
33 Correct 88 ms 93352 KB Correct
34 Correct 107 ms 93120 KB Correct
35 Correct 87 ms 93444 KB Correct
36 Correct 83 ms 93128 KB Correct
37 Correct 3 ms 29016 KB Correct
38 Correct 12 ms 30468 KB Correct
39 Correct 9 ms 30044 KB Correct
40 Correct 11 ms 31368 KB Correct
41 Correct 8 ms 31580 KB Correct
42 Correct 7 ms 31836 KB Correct
43 Correct 7 ms 31324 KB Correct
44 Correct 8 ms 31064 KB Correct
45 Correct 8 ms 30656 KB Correct
46 Correct 9 ms 31324 KB Correct
47 Correct 7 ms 31064 KB Correct
48 Correct 7 ms 32092 KB Correct
49 Correct 10 ms 31964 KB Correct
50 Correct 6 ms 32040 KB Correct
51 Correct 428 ms 126632 KB Correct
52 Correct 364 ms 87240 KB Correct
53 Correct 65 ms 41800 KB Correct
54 Correct 146 ms 58684 KB Correct
55 Correct 338 ms 83404 KB Correct
56 Correct 395 ms 118348 KB Correct
57 Correct 458 ms 128428 KB Correct
58 Correct 344 ms 86244 KB Correct
59 Correct 284 ms 76740 KB Correct
60 Correct 335 ms 112916 KB Correct
61 Correct 401 ms 123776 KB Correct
62 Correct 217 ms 116588 KB Correct
63 Correct 170 ms 116132 KB Correct
64 Correct 179 ms 115960 KB Correct
65 Correct 168 ms 115996 KB Correct
66 Correct 182 ms 117920 KB Correct
67 Correct 200 ms 128552 KB Correct
68 Correct 180 ms 128608 KB Correct
69 Correct 226 ms 124156 KB Correct
70 Correct 217 ms 101568 KB Correct
71 Correct 243 ms 109088 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 91332 KB Correct
2 Correct 148 ms 90364 KB Correct
3 Correct 97 ms 80584 KB Correct
4 Correct 79 ms 84164 KB Correct
5 Correct 118 ms 90288 KB Correct
6 Correct 114 ms 92560 KB Correct
7 Correct 117 ms 79716 KB Correct
8 Correct 107 ms 93388 KB Correct
9 Correct 81 ms 93124 KB Correct
10 Correct 104 ms 93416 KB Correct
11 Correct 80 ms 93128 KB Correct
12 Correct 124 ms 91336 KB Correct
13 Correct 102 ms 90444 KB Correct
14 Correct 113 ms 80752 KB Correct
15 Correct 95 ms 84164 KB Correct
16 Correct 108 ms 90304 KB Correct
17 Correct 115 ms 92532 KB Correct
18 Correct 165 ms 79816 KB Correct
19 Correct 98 ms 93388 KB Correct
20 Correct 108 ms 93116 KB Correct
21 Correct 111 ms 93388 KB Correct
22 Correct 92 ms 93124 KB Correct
23 Correct 138 ms 96228 KB Correct
24 Correct 113 ms 84560 KB Correct
25 Correct 123 ms 88960 KB Correct
26 Correct 3 ms 29020 KB Correct
27 Correct 12 ms 30392 KB Correct
28 Correct 8 ms 30200 KB Correct
29 Correct 11 ms 31420 KB Correct
30 Correct 6 ms 31580 KB Correct
31 Correct 7 ms 31928 KB Correct
32 Correct 11 ms 31480 KB Correct
33 Correct 9 ms 31064 KB Correct
34 Correct 8 ms 30812 KB Correct
35 Correct 11 ms 31320 KB Correct
36 Correct 7 ms 31068 KB Correct
37 Correct 7 ms 31948 KB Correct
38 Correct 11 ms 32040 KB Correct
39 Correct 7 ms 32040 KB Correct
40 Correct 3 ms 29020 KB Correct
41 Correct 13 ms 30316 KB Correct
42 Correct 8 ms 30044 KB Correct
43 Correct 9 ms 31324 KB Correct
44 Correct 6 ms 31580 KB Correct
45 Correct 8 ms 31836 KB Correct
46 Correct 7 ms 31324 KB Correct
47 Correct 12 ms 31068 KB Correct
48 Correct 8 ms 30812 KB Correct
49 Correct 7 ms 31324 KB Correct
50 Correct 10 ms 31068 KB Correct
51 Correct 10 ms 31960 KB Correct
52 Correct 10 ms 32044 KB Correct
53 Correct 6 ms 32044 KB Correct
54 Correct 9 ms 30300 KB Correct
55 Correct 8 ms 31832 KB Correct
56 Correct 9 ms 31244 KB Correct
57 Correct 8 ms 31324 KB Correct
58 Correct 117 ms 91332 KB Correct
59 Correct 132 ms 90372 KB Correct
60 Correct 93 ms 80588 KB Correct
61 Correct 64 ms 84148 KB Correct
62 Correct 86 ms 90440 KB Correct
63 Correct 133 ms 92364 KB Correct
64 Correct 120 ms 79820 KB Correct
65 Correct 88 ms 93352 KB Correct
66 Correct 107 ms 93120 KB Correct
67 Correct 87 ms 93444 KB Correct
68 Correct 83 ms 93128 KB Correct
69 Correct 3 ms 29016 KB Correct
70 Correct 12 ms 30468 KB Correct
71 Correct 9 ms 30044 KB Correct
72 Correct 11 ms 31368 KB Correct
73 Correct 8 ms 31580 KB Correct
74 Correct 7 ms 31836 KB Correct
75 Correct 7 ms 31324 KB Correct
76 Correct 8 ms 31064 KB Correct
77 Correct 8 ms 30656 KB Correct
78 Correct 9 ms 31324 KB Correct
79 Correct 7 ms 31064 KB Correct
80 Correct 7 ms 32092 KB Correct
81 Correct 10 ms 31964 KB Correct
82 Correct 6 ms 32040 KB Correct
83 Correct 428 ms 126632 KB Correct
84 Correct 364 ms 87240 KB Correct
85 Correct 65 ms 41800 KB Correct
86 Correct 146 ms 58684 KB Correct
87 Correct 338 ms 83404 KB Correct
88 Correct 395 ms 118348 KB Correct
89 Correct 458 ms 128428 KB Correct
90 Correct 344 ms 86244 KB Correct
91 Correct 284 ms 76740 KB Correct
92 Correct 335 ms 112916 KB Correct
93 Correct 401 ms 123776 KB Correct
94 Correct 217 ms 116588 KB Correct
95 Correct 170 ms 116132 KB Correct
96 Correct 179 ms 115960 KB Correct
97 Correct 168 ms 115996 KB Correct
98 Correct 182 ms 117920 KB Correct
99 Correct 200 ms 128552 KB Correct
100 Correct 180 ms 128608 KB Correct
101 Correct 226 ms 124156 KB Correct
102 Correct 217 ms 101568 KB Correct
103 Correct 243 ms 109088 KB Correct
104 Correct 103 ms 92356 KB Correct
105 Correct 94 ms 91640 KB Correct
106 Correct 102 ms 81692 KB Correct
107 Correct 95 ms 84548 KB Correct
108 Correct 87 ms 91464 KB Correct
109 Correct 100 ms 93640 KB Correct
110 Correct 115 ms 80932 KB Correct
111 Correct 84 ms 94556 KB Correct
112 Correct 112 ms 94244 KB Correct
113 Correct 70 ms 94408 KB Correct
114 Correct 95 ms 94304 KB Correct
115 Correct 4 ms 29016 KB Correct
116 Correct 10 ms 30492 KB Correct
117 Correct 8 ms 30044 KB Correct
118 Correct 7 ms 31324 KB Correct
119 Correct 6 ms 31580 KB Correct
120 Correct 7 ms 31836 KB Correct
121 Correct 11 ms 31500 KB Correct
122 Correct 8 ms 31068 KB Correct
123 Correct 8 ms 30736 KB Correct
124 Correct 8 ms 31324 KB Correct
125 Correct 7 ms 31164 KB Correct
126 Correct 8 ms 32088 KB Correct
127 Correct 10 ms 32064 KB Correct
128 Correct 7 ms 32008 KB Correct
129 Correct 444 ms 129512 KB Correct
130 Correct 415 ms 89320 KB Correct
131 Correct 64 ms 41996 KB Correct
132 Correct 145 ms 59712 KB Correct
133 Correct 306 ms 85188 KB Correct
134 Correct 395 ms 120900 KB Correct
135 Correct 421 ms 131248 KB Correct
136 Correct 351 ms 87640 KB Correct
137 Correct 314 ms 78012 KB Correct
138 Correct 312 ms 115420 KB Correct
139 Correct 435 ms 126484 KB Correct
140 Correct 203 ms 118344 KB Correct
141 Correct 166 ms 118324 KB Correct
142 Correct 164 ms 118280 KB Correct
143 Correct 229 ms 118356 KB Correct
144 Correct 183 ms 120224 KB Correct
145 Correct 213 ms 130824 KB Correct
146 Correct 234 ms 130916 KB Correct
147 Correct 224 ms 126476 KB Correct
148 Correct 268 ms 104320 KB Correct
149 Correct 221 ms 111936 KB Correct
150 Correct 132 ms 97220 KB Correct
151 Correct 99 ms 84424 KB Correct
152 Correct 110 ms 89040 KB Correct
153 Correct 12 ms 30480 KB Correct
154 Correct 8 ms 31592 KB Correct
155 Correct 13 ms 31068 KB Correct
156 Correct 8 ms 31324 KB Correct
157 Correct 432 ms 135828 KB Correct
158 Correct 381 ms 93596 KB Correct
159 Correct 60 ms 45232 KB Correct
160 Correct 515 ms 135068 KB Correct
161 Correct 461 ms 136080 KB Correct
162 Correct 396 ms 90724 KB Correct
163 Correct 413 ms 124976 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 29016 KB Correct
2 Correct 5 ms 29020 KB Correct
3 Correct 5 ms 29020 KB Correct
4 Correct 5 ms 29020 KB Correct
5 Correct 4 ms 29200 KB Correct
6 Correct 5 ms 29016 KB Correct
7 Correct 4 ms 29020 KB Correct
8 Correct 4 ms 29020 KB Correct
9 Correct 3 ms 29196 KB Correct
10 Correct 129 ms 91332 KB Correct
11 Correct 148 ms 90364 KB Correct
12 Correct 97 ms 80584 KB Correct
13 Correct 79 ms 84164 KB Correct
14 Correct 118 ms 90288 KB Correct
15 Correct 114 ms 92560 KB Correct
16 Correct 117 ms 79716 KB Correct
17 Correct 107 ms 93388 KB Correct
18 Correct 81 ms 93124 KB Correct
19 Correct 104 ms 93416 KB Correct
20 Correct 80 ms 93128 KB Correct
21 Correct 124 ms 91336 KB Correct
22 Correct 102 ms 90444 KB Correct
23 Correct 113 ms 80752 KB Correct
24 Correct 95 ms 84164 KB Correct
25 Correct 108 ms 90304 KB Correct
26 Correct 115 ms 92532 KB Correct
27 Correct 165 ms 79816 KB Correct
28 Correct 98 ms 93388 KB Correct
29 Correct 108 ms 93116 KB Correct
30 Correct 111 ms 93388 KB Correct
31 Correct 92 ms 93124 KB Correct
32 Correct 138 ms 96228 KB Correct
33 Correct 113 ms 84560 KB Correct
34 Correct 123 ms 88960 KB Correct
35 Correct 3 ms 29020 KB Correct
36 Correct 5 ms 29020 KB Correct
37 Correct 4 ms 29016 KB Correct
38 Correct 5 ms 29272 KB Correct
39 Correct 4 ms 29020 KB Correct
40 Correct 3 ms 29016 KB Correct
41 Correct 4 ms 29020 KB Correct
42 Correct 146 ms 92308 KB Correct
43 Correct 155 ms 91580 KB Correct
44 Correct 114 ms 81576 KB Correct
45 Correct 83 ms 84680 KB Correct
46 Correct 105 ms 91468 KB Correct
47 Correct 143 ms 93640 KB Correct
48 Correct 123 ms 80980 KB Correct
49 Correct 88 ms 94408 KB Correct
50 Correct 86 ms 94336 KB Correct
51 Correct 76 ms 94408 KB Correct
52 Correct 77 ms 94288 KB Correct
53 Correct 138 ms 97224 KB Correct
54 Correct 94 ms 84424 KB Correct
55 Correct 99 ms 89036 KB Correct
56 Correct 82 ms 67892 KB Correct
57 Correct 5 ms 31836 KB Correct
58 Correct 3 ms 29020 KB Correct
59 Correct 12 ms 30392 KB Correct
60 Correct 8 ms 30200 KB Correct
61 Correct 11 ms 31420 KB Correct
62 Correct 6 ms 31580 KB Correct
63 Correct 7 ms 31928 KB Correct
64 Correct 11 ms 31480 KB Correct
65 Correct 9 ms 31064 KB Correct
66 Correct 8 ms 30812 KB Correct
67 Correct 11 ms 31320 KB Correct
68 Correct 7 ms 31068 KB Correct
69 Correct 7 ms 31948 KB Correct
70 Correct 11 ms 32040 KB Correct
71 Correct 7 ms 32040 KB Correct
72 Correct 3 ms 29020 KB Correct
73 Correct 13 ms 30316 KB Correct
74 Correct 8 ms 30044 KB Correct
75 Correct 9 ms 31324 KB Correct
76 Correct 6 ms 31580 KB Correct
77 Correct 8 ms 31836 KB Correct
78 Correct 7 ms 31324 KB Correct
79 Correct 12 ms 31068 KB Correct
80 Correct 8 ms 30812 KB Correct
81 Correct 7 ms 31324 KB Correct
82 Correct 10 ms 31068 KB Correct
83 Correct 10 ms 31960 KB Correct
84 Correct 10 ms 32044 KB Correct
85 Correct 6 ms 32044 KB Correct
86 Correct 9 ms 30300 KB Correct
87 Correct 8 ms 31832 KB Correct
88 Correct 9 ms 31244 KB Correct
89 Correct 8 ms 31324 KB Correct
90 Correct 5 ms 29020 KB Correct
91 Correct 11 ms 30300 KB Correct
92 Correct 8 ms 30044 KB Correct
93 Correct 8 ms 31324 KB Correct
94 Correct 9 ms 31784 KB Correct
95 Correct 7 ms 31984 KB Correct
96 Correct 11 ms 31324 KB Correct
97 Correct 8 ms 31068 KB Correct
98 Correct 8 ms 30812 KB Correct
99 Correct 8 ms 31428 KB Correct
100 Correct 11 ms 31068 KB Correct
101 Correct 11 ms 32092 KB Correct
102 Correct 7 ms 32092 KB Correct
103 Correct 11 ms 32068 KB Correct
104 Correct 12 ms 30472 KB Correct
105 Correct 8 ms 31580 KB Correct
106 Correct 12 ms 31380 KB Correct
107 Correct 8 ms 31460 KB Correct
108 Correct 5 ms 29020 KB Correct
109 Correct 3 ms 29112 KB Correct
110 Correct 3 ms 29016 KB Correct
111 Correct 4 ms 29020 KB Correct
112 Correct 4 ms 29020 KB Correct
113 Correct 4 ms 29020 KB Correct
114 Correct 3 ms 29020 KB Correct
115 Correct 88 ms 48416 KB Correct
116 Correct 658 ms 60252 KB Correct
117 Correct 14 ms 32228 KB Correct
118 Correct 22 ms 37980 KB Correct
119 Correct 117 ms 91332 KB Correct
120 Correct 132 ms 90372 KB Correct
121 Correct 93 ms 80588 KB Correct
122 Correct 64 ms 84148 KB Correct
123 Correct 86 ms 90440 KB Correct
124 Correct 133 ms 92364 KB Correct
125 Correct 120 ms 79820 KB Correct
126 Correct 88 ms 93352 KB Correct
127 Correct 107 ms 93120 KB Correct
128 Correct 87 ms 93444 KB Correct
129 Correct 83 ms 93128 KB Correct
130 Correct 3 ms 29016 KB Correct
131 Correct 12 ms 30468 KB Correct
132 Correct 9 ms 30044 KB Correct
133 Correct 11 ms 31368 KB Correct
134 Correct 8 ms 31580 KB Correct
135 Correct 7 ms 31836 KB Correct
136 Correct 7 ms 31324 KB Correct
137 Correct 8 ms 31064 KB Correct
138 Correct 8 ms 30656 KB Correct
139 Correct 9 ms 31324 KB Correct
140 Correct 7 ms 31064 KB Correct
141 Correct 7 ms 32092 KB Correct
142 Correct 10 ms 31964 KB Correct
143 Correct 6 ms 32040 KB Correct
144 Correct 428 ms 126632 KB Correct
145 Correct 364 ms 87240 KB Correct
146 Correct 65 ms 41800 KB Correct
147 Correct 146 ms 58684 KB Correct
148 Correct 338 ms 83404 KB Correct
149 Correct 395 ms 118348 KB Correct
150 Correct 458 ms 128428 KB Correct
151 Correct 344 ms 86244 KB Correct
152 Correct 284 ms 76740 KB Correct
153 Correct 335 ms 112916 KB Correct
154 Correct 401 ms 123776 KB Correct
155 Correct 217 ms 116588 KB Correct
156 Correct 170 ms 116132 KB Correct
157 Correct 179 ms 115960 KB Correct
158 Correct 168 ms 115996 KB Correct
159 Correct 182 ms 117920 KB Correct
160 Correct 200 ms 128552 KB Correct
161 Correct 180 ms 128608 KB Correct
162 Correct 226 ms 124156 KB Correct
163 Correct 217 ms 101568 KB Correct
164 Correct 243 ms 109088 KB Correct
165 Correct 103 ms 92356 KB Correct
166 Correct 94 ms 91640 KB Correct
167 Correct 102 ms 81692 KB Correct
168 Correct 95 ms 84548 KB Correct
169 Correct 87 ms 91464 KB Correct
170 Correct 100 ms 93640 KB Correct
171 Correct 115 ms 80932 KB Correct
172 Correct 84 ms 94556 KB Correct
173 Correct 112 ms 94244 KB Correct
174 Correct 70 ms 94408 KB Correct
175 Correct 95 ms 94304 KB Correct
176 Correct 4 ms 29016 KB Correct
177 Correct 10 ms 30492 KB Correct
178 Correct 8 ms 30044 KB Correct
179 Correct 7 ms 31324 KB Correct
180 Correct 6 ms 31580 KB Correct
181 Correct 7 ms 31836 KB Correct
182 Correct 11 ms 31500 KB Correct
183 Correct 8 ms 31068 KB Correct
184 Correct 8 ms 30736 KB Correct
185 Correct 8 ms 31324 KB Correct
186 Correct 7 ms 31164 KB Correct
187 Correct 8 ms 32088 KB Correct
188 Correct 10 ms 32064 KB Correct
189 Correct 7 ms 32008 KB Correct
190 Correct 444 ms 129512 KB Correct
191 Correct 415 ms 89320 KB Correct
192 Correct 64 ms 41996 KB Correct
193 Correct 145 ms 59712 KB Correct
194 Correct 306 ms 85188 KB Correct
195 Correct 395 ms 120900 KB Correct
196 Correct 421 ms 131248 KB Correct
197 Correct 351 ms 87640 KB Correct
198 Correct 314 ms 78012 KB Correct
199 Correct 312 ms 115420 KB Correct
200 Correct 435 ms 126484 KB Correct
201 Correct 203 ms 118344 KB Correct
202 Correct 166 ms 118324 KB Correct
203 Correct 164 ms 118280 KB Correct
204 Correct 229 ms 118356 KB Correct
205 Correct 183 ms 120224 KB Correct
206 Correct 213 ms 130824 KB Correct
207 Correct 234 ms 130916 KB Correct
208 Correct 224 ms 126476 KB Correct
209 Correct 268 ms 104320 KB Correct
210 Correct 221 ms 111936 KB Correct
211 Correct 132 ms 97220 KB Correct
212 Correct 99 ms 84424 KB Correct
213 Correct 110 ms 89040 KB Correct
214 Correct 12 ms 30480 KB Correct
215 Correct 8 ms 31592 KB Correct
216 Correct 13 ms 31068 KB Correct
217 Correct 8 ms 31324 KB Correct
218 Correct 432 ms 135828 KB Correct
219 Correct 381 ms 93596 KB Correct
220 Correct 60 ms 45232 KB Correct
221 Correct 515 ms 135068 KB Correct
222 Correct 461 ms 136080 KB Correct
223 Correct 396 ms 90724 KB Correct
224 Correct 413 ms 124976 KB Correct
225 Correct 113 ms 92360 KB Correct
226 Correct 121 ms 91488 KB Correct
227 Correct 88 ms 81612 KB Correct
228 Correct 65 ms 84688 KB Correct
229 Correct 88 ms 91632 KB Correct
230 Correct 111 ms 93636 KB Correct
231 Correct 105 ms 80968 KB Correct
232 Correct 87 ms 94412 KB Correct
233 Correct 99 ms 94148 KB Correct
234 Correct 71 ms 94408 KB Correct
235 Correct 70 ms 94324 KB Correct
236 Correct 4 ms 29016 KB Correct
237 Correct 9 ms 30300 KB Correct
238 Correct 8 ms 30140 KB Correct
239 Correct 8 ms 31320 KB Correct
240 Correct 6 ms 31580 KB Correct
241 Correct 7 ms 32036 KB Correct
242 Correct 7 ms 31324 KB Correct
243 Correct 10 ms 31068 KB Correct
244 Correct 8 ms 30840 KB Correct
245 Correct 8 ms 31576 KB Correct
246 Correct 7 ms 31068 KB Correct
247 Correct 7 ms 32028 KB Correct
248 Correct 8 ms 32068 KB Correct
249 Correct 7 ms 31916 KB Correct
250 Correct 403 ms 129636 KB Correct
251 Correct 380 ms 89288 KB Correct
252 Correct 65 ms 41952 KB Correct
253 Correct 114 ms 59696 KB Correct
254 Correct 304 ms 85112 KB Correct
255 Correct 343 ms 120900 KB Correct
256 Correct 414 ms 131480 KB Correct
257 Correct 345 ms 87588 KB Correct
258 Correct 284 ms 77892 KB Correct
259 Correct 306 ms 115492 KB Correct
260 Correct 379 ms 126656 KB Correct
261 Correct 216 ms 118428 KB Correct
262 Correct 160 ms 118436 KB Correct
263 Correct 180 ms 118276 KB Correct
264 Correct 168 ms 118452 KB Correct
265 Correct 182 ms 120220 KB Correct
266 Correct 193 ms 130856 KB Correct
267 Correct 185 ms 130820 KB Correct
268 Correct 165 ms 126420 KB Correct
269 Correct 216 ms 104384 KB Correct
270 Correct 228 ms 111936 KB Correct
271 Correct 107 ms 97220 KB Correct
272 Correct 77 ms 84424 KB Correct
273 Correct 104 ms 88864 KB Correct
274 Correct 9 ms 30300 KB Correct
275 Correct 8 ms 31580 KB Correct
276 Correct 9 ms 31068 KB Correct
277 Correct 8 ms 31324 KB Correct
278 Correct 425 ms 135356 KB Correct
279 Correct 373 ms 93376 KB Correct
280 Correct 60 ms 45480 KB Correct
281 Correct 439 ms 136888 KB Correct
282 Correct 441 ms 134848 KB Correct
283 Correct 350 ms 90812 KB Correct
284 Correct 386 ms 123968 KB Correct
285 Correct 3 ms 29020 KB Correct
286 Correct 4 ms 29196 KB Correct
287 Correct 3 ms 29016 KB Correct
288 Correct 3 ms 29020 KB Correct
289 Correct 4 ms 29020 KB Correct
290 Correct 4 ms 29020 KB Correct
291 Correct 5 ms 29020 KB Correct
292 Correct 59 ms 67888 KB Correct
293 Correct 5 ms 31832 KB Correct
294 Correct 74 ms 50056 KB Correct
295 Correct 669 ms 60204 KB Correct
296 Correct 12 ms 32224 KB Correct
297 Correct 17 ms 37980 KB Correct
298 Correct 464 ms 143696 KB Correct
299 Correct 480 ms 94148 KB Correct
300 Correct 357 ms 90044 KB Correct
301 Correct 350 ms 89552 KB Correct
302 Correct 354 ms 89324 KB Correct
303 Correct 432 ms 137760 KB Correct
304 Correct 435 ms 128056 KB Correct
305 Correct 436 ms 127552 KB Correct
306 Correct 478 ms 112196 KB Correct
307 Correct 401 ms 131800 KB Correct