Submission #697504

# Submission time Handle Problem Language Result Execution time Memory
697504 2023-02-10T07:01:22 Z sharaelong Painting Walls (APIO20_paint) C++17
63 / 100
1500 ms 315112 KB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX_N = 1e5 + 1;

bool processed[MAX_N][633];

int minimumInstructions(int n, int m, int k, vector<int> C, vector<int> A, vector<vector<int>> B) {
    vector<vector<int>> likes(k);
    for (int i=0; i<m; ++i) {
        for (int j=0; j<A[i]; ++j) {
            likes[B[i][j]].push_back(i);
        }
    }
    // for (int i=0; i<k; ++i) {
    //     for (int x: likes[i]) cout << x << ' ';
    //     cout << endl;
    // }
    
    vector<vector<int>> nxt(n);
    // vector<vector<bool>> processed(n);
    for (int i=0; i<n; ++i) {
        nxt[i].resize(likes[C[i]].size(), -1);
        // processed[i].resize(likes[C[i]].size(), false);
    }

    vector<int> pnt(n, 0);
    for (int i=0; i+1<n; ++i) {
        const vector<int>& cands = likes[C[i+1]];
        for (int j=0; j<likes[C[i]].size(); ++j) {
            int x = likes[C[i]][j];
            if (x+1 < m) {
                while (pnt[i+1] < cands.size() && cands[pnt[i+1]] <= x) pnt[i+1]++;
                if (pnt[i+1] < cands.size() && cands[pnt[i+1]] == x+1) nxt[i][j] = pnt[i+1];
            } else {
                if (!cands.empty() && cands[0] == 0) nxt[i][j] = 0;
            }
        }
    }
    // for (int i=0; i<n; ++i) {
    //     for (int x: nxt[i]) cout << x << ' ';
    //     cout << endl;
    // }

    vector<int> okay(n+1, 0);
    for (int i=0; i<n; ++i) {
        for (int j=0; j<likes[C[i]].size(); ++j) {
            if (!processed[i][j]) {
                processed[i][j] = true;
                int ii = i, jj = j;
                while (ii < n && nxt[ii][jj] != -1) {
                    jj = nxt[ii][jj];
                    ii++;
                    processed[ii][jj] = true;
                }

                if (ii == n) ii--;
                if (ii-i+1 >= m) {
                    okay[i]++;
                    okay[ii-m+2]--;
                }
            }
        }
    }
    for (int i=1; i<okay.size(); ++i) okay[i] += okay[i-1];
    // for (int i=0; i<n; ++i) cout << okay[i] << ' ';
    // cout << endl;

    vector<int> valid_pos;
    for (int i=0; i<n; ++i) {
        if (okay[i] > 0) valid_pos.push_back(i);
    }
    if (valid_pos.empty() || valid_pos[0] > 0) return -1;

    int ans = 1;
    int curr = 0;
    while (curr + m < n) {
        auto it = upper_bound(valid_pos.begin(), valid_pos.end(), curr+m);
        if (*prev(it) == curr) return -1;
        curr = *prev(it);
        ans++;
    }
    return ans;
}

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:32:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for (int j=0; j<likes[C[i]].size(); ++j) {
      |                       ~^~~~~~~~~~~~~~~~~~~
paint.cpp:35:33: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |                 while (pnt[i+1] < cands.size() && cands[pnt[i+1]] <= x) pnt[i+1]++;
paint.cpp:36:30: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |                 if (pnt[i+1] < cands.size() && cands[pnt[i+1]] == x+1) nxt[i][j] = pnt[i+1];
paint.cpp:49:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         for (int j=0; j<likes[C[i]].size(); ++j) {
      |                       ~^~~~~~~~~~~~~~~~~~~
paint.cpp:67:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |     for (int i=1; i<okay.size(); ++i) okay[i] += okay[i-1];
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 0 ms 596 KB Output is correct
9 Correct 1 ms 608 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 2 ms 3028 KB Output is correct
14 Correct 2 ms 3028 KB Output is correct
15 Correct 2 ms 3028 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2772 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 18 ms 6900 KB Output is correct
23 Correct 26 ms 6888 KB Output is correct
24 Correct 19 ms 6864 KB Output is correct
25 Correct 14 ms 14296 KB Output is correct
26 Correct 9 ms 14292 KB Output is correct
27 Correct 9 ms 14204 KB Output is correct
28 Correct 10 ms 14036 KB Output is correct
29 Correct 11 ms 14036 KB Output is correct
30 Correct 9 ms 14036 KB Output is correct
31 Correct 15 ms 17532 KB Output is correct
32 Correct 14 ms 17492 KB Output is correct
33 Correct 14 ms 17540 KB Output is correct
34 Correct 17 ms 17492 KB Output is correct
35 Correct 14 ms 17492 KB Output is correct
36 Correct 15 ms 17536 KB Output is correct
37 Correct 30 ms 20416 KB Output is correct
38 Correct 31 ms 20496 KB Output is correct
39 Correct 30 ms 20512 KB Output is correct
40 Correct 40 ms 63488 KB Output is correct
41 Correct 27 ms 39852 KB Output is correct
42 Correct 46 ms 68540 KB Output is correct
43 Correct 30 ms 45412 KB Output is correct
44 Correct 27 ms 41324 KB Output is correct
45 Correct 46 ms 69152 KB Output is correct
46 Correct 66 ms 70864 KB Output is correct
47 Correct 42 ms 45464 KB Output is correct
48 Correct 52 ms 47816 KB Output is correct
49 Correct 62 ms 51224 KB Output is correct
50 Correct 63 ms 57292 KB Output is correct
51 Correct 57 ms 57268 KB Output is correct
52 Correct 43 ms 69884 KB Output is correct
53 Correct 42 ms 69860 KB Output is correct
54 Correct 44 ms 69544 KB Output is correct
55 Correct 45 ms 69304 KB Output is correct
56 Correct 50 ms 69176 KB Output is correct
57 Correct 51 ms 69168 KB Output is correct
58 Correct 72 ms 80972 KB Output is correct
59 Correct 71 ms 80976 KB Output is correct
60 Correct 78 ms 80968 KB Output is correct
61 Correct 73 ms 80896 KB Output is correct
62 Correct 85 ms 80988 KB Output is correct
63 Correct 73 ms 80972 KB Output is correct
64 Correct 85 ms 79904 KB Output is correct
65 Correct 83 ms 79828 KB Output is correct
66 Correct 84 ms 79820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 0 ms 596 KB Output is correct
9 Correct 1 ms 608 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 2 ms 3028 KB Output is correct
14 Correct 2 ms 3028 KB Output is correct
15 Correct 2 ms 3028 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2772 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 1 ms 596 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 2 ms 2516 KB Output is correct
34 Correct 1 ms 2132 KB Output is correct
35 Correct 1 ms 1748 KB Output is correct
36 Correct 2 ms 2900 KB Output is correct
37 Correct 2 ms 2388 KB Output is correct
38 Correct 2 ms 2364 KB Output is correct
39 Correct 1 ms 468 KB Output is correct
40 Correct 1 ms 2132 KB Output is correct
41 Correct 1 ms 468 KB Output is correct
42 Correct 2 ms 2516 KB Output is correct
43 Correct 2 ms 2644 KB Output is correct
44 Correct 1 ms 596 KB Output is correct
45 Correct 1 ms 596 KB Output is correct
46 Correct 1 ms 596 KB Output is correct
47 Correct 1 ms 596 KB Output is correct
48 Correct 1 ms 596 KB Output is correct
49 Correct 1 ms 596 KB Output is correct
50 Correct 2 ms 3028 KB Output is correct
51 Correct 2 ms 3028 KB Output is correct
52 Correct 2 ms 3028 KB Output is correct
53 Correct 2 ms 3028 KB Output is correct
54 Correct 2 ms 3028 KB Output is correct
55 Correct 2 ms 3028 KB Output is correct
56 Correct 2 ms 2644 KB Output is correct
57 Correct 1 ms 596 KB Output is correct
58 Correct 2 ms 2644 KB Output is correct
59 Correct 1 ms 596 KB Output is correct
60 Correct 2 ms 2644 KB Output is correct
61 Correct 1 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 0 ms 596 KB Output is correct
11 Correct 1 ms 608 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 2 ms 3028 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 3028 KB Output is correct
20 Correct 2 ms 3028 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 2 ms 2772 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 18 ms 6900 KB Output is correct
25 Correct 26 ms 6888 KB Output is correct
26 Correct 19 ms 6864 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 1 ms 468 KB Output is correct
34 Correct 1 ms 596 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 2 ms 2516 KB Output is correct
37 Correct 1 ms 2132 KB Output is correct
38 Correct 1 ms 1748 KB Output is correct
39 Correct 2 ms 2900 KB Output is correct
40 Correct 2 ms 2388 KB Output is correct
41 Correct 2 ms 2364 KB Output is correct
42 Correct 1 ms 468 KB Output is correct
43 Correct 1 ms 2132 KB Output is correct
44 Correct 1 ms 468 KB Output is correct
45 Correct 2 ms 2516 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 1 ms 596 KB Output is correct
48 Correct 1 ms 596 KB Output is correct
49 Correct 1 ms 596 KB Output is correct
50 Correct 1 ms 596 KB Output is correct
51 Correct 1 ms 596 KB Output is correct
52 Correct 1 ms 596 KB Output is correct
53 Correct 2 ms 3028 KB Output is correct
54 Correct 2 ms 3028 KB Output is correct
55 Correct 2 ms 3028 KB Output is correct
56 Correct 2 ms 3028 KB Output is correct
57 Correct 2 ms 3028 KB Output is correct
58 Correct 2 ms 3028 KB Output is correct
59 Correct 2 ms 2644 KB Output is correct
60 Correct 1 ms 596 KB Output is correct
61 Correct 2 ms 2644 KB Output is correct
62 Correct 1 ms 596 KB Output is correct
63 Correct 2 ms 2644 KB Output is correct
64 Correct 1 ms 596 KB Output is correct
65 Correct 1 ms 596 KB Output is correct
66 Correct 1 ms 596 KB Output is correct
67 Correct 2 ms 852 KB Output is correct
68 Correct 1 ms 724 KB Output is correct
69 Correct 1 ms 724 KB Output is correct
70 Correct 3 ms 2772 KB Output is correct
71 Correct 3 ms 2388 KB Output is correct
72 Correct 3 ms 2132 KB Output is correct
73 Correct 2 ms 2260 KB Output is correct
74 Correct 2 ms 2516 KB Output is correct
75 Correct 3 ms 2900 KB Output is correct
76 Correct 20 ms 4692 KB Output is correct
77 Correct 17 ms 5588 KB Output is correct
78 Correct 21 ms 6264 KB Output is correct
79 Correct 2 ms 980 KB Output is correct
80 Correct 2 ms 980 KB Output is correct
81 Correct 2 ms 980 KB Output is correct
82 Correct 2 ms 980 KB Output is correct
83 Correct 2 ms 980 KB Output is correct
84 Correct 3 ms 3156 KB Output is correct
85 Correct 3 ms 3156 KB Output is correct
86 Correct 4 ms 3156 KB Output is correct
87 Correct 4 ms 3156 KB Output is correct
88 Correct 4 ms 3156 KB Output is correct
89 Correct 3 ms 3156 KB Output is correct
90 Correct 25 ms 6652 KB Output is correct
91 Correct 25 ms 6624 KB Output is correct
92 Correct 27 ms 6636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 0 ms 596 KB Output is correct
11 Correct 1 ms 608 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 2 ms 3028 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 3028 KB Output is correct
20 Correct 2 ms 3028 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 2 ms 2772 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 18 ms 6900 KB Output is correct
25 Correct 26 ms 6888 KB Output is correct
26 Correct 19 ms 6864 KB Output is correct
27 Correct 14 ms 14296 KB Output is correct
28 Correct 9 ms 14292 KB Output is correct
29 Correct 9 ms 14204 KB Output is correct
30 Correct 10 ms 14036 KB Output is correct
31 Correct 11 ms 14036 KB Output is correct
32 Correct 9 ms 14036 KB Output is correct
33 Correct 15 ms 17532 KB Output is correct
34 Correct 14 ms 17492 KB Output is correct
35 Correct 14 ms 17540 KB Output is correct
36 Correct 17 ms 17492 KB Output is correct
37 Correct 14 ms 17492 KB Output is correct
38 Correct 15 ms 17536 KB Output is correct
39 Correct 30 ms 20416 KB Output is correct
40 Correct 31 ms 20496 KB Output is correct
41 Correct 30 ms 20512 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 1 ms 468 KB Output is correct
46 Correct 1 ms 468 KB Output is correct
47 Correct 1 ms 468 KB Output is correct
48 Correct 1 ms 468 KB Output is correct
49 Correct 1 ms 596 KB Output is correct
50 Correct 1 ms 468 KB Output is correct
51 Correct 2 ms 2516 KB Output is correct
52 Correct 1 ms 2132 KB Output is correct
53 Correct 1 ms 1748 KB Output is correct
54 Correct 2 ms 2900 KB Output is correct
55 Correct 2 ms 2388 KB Output is correct
56 Correct 2 ms 2364 KB Output is correct
57 Correct 1 ms 468 KB Output is correct
58 Correct 1 ms 2132 KB Output is correct
59 Correct 1 ms 468 KB Output is correct
60 Correct 2 ms 2516 KB Output is correct
61 Correct 2 ms 2644 KB Output is correct
62 Correct 1 ms 596 KB Output is correct
63 Correct 1 ms 596 KB Output is correct
64 Correct 1 ms 596 KB Output is correct
65 Correct 1 ms 596 KB Output is correct
66 Correct 1 ms 596 KB Output is correct
67 Correct 1 ms 596 KB Output is correct
68 Correct 2 ms 3028 KB Output is correct
69 Correct 2 ms 3028 KB Output is correct
70 Correct 2 ms 3028 KB Output is correct
71 Correct 2 ms 3028 KB Output is correct
72 Correct 2 ms 3028 KB Output is correct
73 Correct 2 ms 3028 KB Output is correct
74 Correct 2 ms 2644 KB Output is correct
75 Correct 1 ms 596 KB Output is correct
76 Correct 2 ms 2644 KB Output is correct
77 Correct 1 ms 596 KB Output is correct
78 Correct 2 ms 2644 KB Output is correct
79 Correct 1 ms 596 KB Output is correct
80 Correct 1 ms 596 KB Output is correct
81 Correct 1 ms 596 KB Output is correct
82 Correct 2 ms 852 KB Output is correct
83 Correct 1 ms 724 KB Output is correct
84 Correct 1 ms 724 KB Output is correct
85 Correct 3 ms 2772 KB Output is correct
86 Correct 3 ms 2388 KB Output is correct
87 Correct 3 ms 2132 KB Output is correct
88 Correct 2 ms 2260 KB Output is correct
89 Correct 2 ms 2516 KB Output is correct
90 Correct 3 ms 2900 KB Output is correct
91 Correct 20 ms 4692 KB Output is correct
92 Correct 17 ms 5588 KB Output is correct
93 Correct 21 ms 6264 KB Output is correct
94 Correct 2 ms 980 KB Output is correct
95 Correct 2 ms 980 KB Output is correct
96 Correct 2 ms 980 KB Output is correct
97 Correct 2 ms 980 KB Output is correct
98 Correct 2 ms 980 KB Output is correct
99 Correct 3 ms 3156 KB Output is correct
100 Correct 3 ms 3156 KB Output is correct
101 Correct 4 ms 3156 KB Output is correct
102 Correct 4 ms 3156 KB Output is correct
103 Correct 4 ms 3156 KB Output is correct
104 Correct 3 ms 3156 KB Output is correct
105 Correct 25 ms 6652 KB Output is correct
106 Correct 25 ms 6624 KB Output is correct
107 Correct 27 ms 6636 KB Output is correct
108 Correct 9 ms 14164 KB Output is correct
109 Correct 140 ms 45124 KB Output is correct
110 Correct 97 ms 27596 KB Output is correct
111 Correct 76 ms 22128 KB Output is correct
112 Correct 82 ms 26824 KB Output is correct
113 Correct 54 ms 18252 KB Output is correct
114 Correct 17 ms 11348 KB Output is correct
115 Correct 15 ms 10324 KB Output is correct
116 Correct 27 ms 16404 KB Output is correct
117 Correct 15 ms 10452 KB Output is correct
118 Correct 17 ms 12372 KB Output is correct
119 Correct 14 ms 13396 KB Output is correct
120 Correct 23 ms 12208 KB Output is correct
121 Correct 9 ms 9328 KB Output is correct
122 Correct 25 ms 11960 KB Output is correct
123 Correct 8 ms 8916 KB Output is correct
124 Correct 31 ms 17876 KB Output is correct
125 Correct 12 ms 14316 KB Output is correct
126 Correct 11 ms 13012 KB Output is correct
127 Correct 14 ms 15828 KB Output is correct
128 Correct 10 ms 11884 KB Output is correct
129 Correct 12 ms 11860 KB Output is correct
130 Correct 9 ms 14312 KB Output is correct
131 Correct 202 ms 63464 KB Output is correct
132 Correct 169 ms 48716 KB Output is correct
133 Correct 138 ms 42352 KB Output is correct
134 Correct 119 ms 38528 KB Output is correct
135 Correct 106 ms 35868 KB Output is correct
136 Correct 25 ms 18044 KB Output is correct
137 Correct 29 ms 18008 KB Output is correct
138 Correct 30 ms 18008 KB Output is correct
139 Correct 25 ms 18004 KB Output is correct
140 Correct 23 ms 17996 KB Output is correct
141 Correct 26 ms 18012 KB Output is correct
142 Correct 39 ms 20140 KB Output is correct
143 Correct 14 ms 15364 KB Output is correct
144 Correct 39 ms 20172 KB Output is correct
145 Correct 15 ms 15412 KB Output is correct
146 Correct 38 ms 20196 KB Output is correct
147 Correct 14 ms 15444 KB Output is correct
148 Correct 15 ms 17492 KB Output is correct
149 Correct 16 ms 17376 KB Output is correct
150 Correct 16 ms 17364 KB Output is correct
151 Correct 15 ms 17296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 0 ms 596 KB Output is correct
11 Correct 1 ms 608 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 2 ms 3028 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 3028 KB Output is correct
20 Correct 2 ms 3028 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 2 ms 2772 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 18 ms 6900 KB Output is correct
25 Correct 26 ms 6888 KB Output is correct
26 Correct 19 ms 6864 KB Output is correct
27 Correct 14 ms 14296 KB Output is correct
28 Correct 9 ms 14292 KB Output is correct
29 Correct 9 ms 14204 KB Output is correct
30 Correct 10 ms 14036 KB Output is correct
31 Correct 11 ms 14036 KB Output is correct
32 Correct 9 ms 14036 KB Output is correct
33 Correct 15 ms 17532 KB Output is correct
34 Correct 14 ms 17492 KB Output is correct
35 Correct 14 ms 17540 KB Output is correct
36 Correct 17 ms 17492 KB Output is correct
37 Correct 14 ms 17492 KB Output is correct
38 Correct 15 ms 17536 KB Output is correct
39 Correct 30 ms 20416 KB Output is correct
40 Correct 31 ms 20496 KB Output is correct
41 Correct 30 ms 20512 KB Output is correct
42 Correct 40 ms 63488 KB Output is correct
43 Correct 27 ms 39852 KB Output is correct
44 Correct 46 ms 68540 KB Output is correct
45 Correct 30 ms 45412 KB Output is correct
46 Correct 27 ms 41324 KB Output is correct
47 Correct 46 ms 69152 KB Output is correct
48 Correct 66 ms 70864 KB Output is correct
49 Correct 42 ms 45464 KB Output is correct
50 Correct 52 ms 47816 KB Output is correct
51 Correct 62 ms 51224 KB Output is correct
52 Correct 63 ms 57292 KB Output is correct
53 Correct 57 ms 57268 KB Output is correct
54 Correct 43 ms 69884 KB Output is correct
55 Correct 42 ms 69860 KB Output is correct
56 Correct 44 ms 69544 KB Output is correct
57 Correct 45 ms 69304 KB Output is correct
58 Correct 50 ms 69176 KB Output is correct
59 Correct 51 ms 69168 KB Output is correct
60 Correct 72 ms 80972 KB Output is correct
61 Correct 71 ms 80976 KB Output is correct
62 Correct 78 ms 80968 KB Output is correct
63 Correct 73 ms 80896 KB Output is correct
64 Correct 85 ms 80988 KB Output is correct
65 Correct 73 ms 80972 KB Output is correct
66 Correct 85 ms 79904 KB Output is correct
67 Correct 83 ms 79828 KB Output is correct
68 Correct 84 ms 79820 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 468 KB Output is correct
73 Correct 1 ms 468 KB Output is correct
74 Correct 1 ms 468 KB Output is correct
75 Correct 1 ms 468 KB Output is correct
76 Correct 1 ms 596 KB Output is correct
77 Correct 1 ms 468 KB Output is correct
78 Correct 2 ms 2516 KB Output is correct
79 Correct 1 ms 2132 KB Output is correct
80 Correct 1 ms 1748 KB Output is correct
81 Correct 2 ms 2900 KB Output is correct
82 Correct 2 ms 2388 KB Output is correct
83 Correct 2 ms 2364 KB Output is correct
84 Correct 1 ms 468 KB Output is correct
85 Correct 1 ms 2132 KB Output is correct
86 Correct 1 ms 468 KB Output is correct
87 Correct 2 ms 2516 KB Output is correct
88 Correct 2 ms 2644 KB Output is correct
89 Correct 1 ms 596 KB Output is correct
90 Correct 1 ms 596 KB Output is correct
91 Correct 1 ms 596 KB Output is correct
92 Correct 1 ms 596 KB Output is correct
93 Correct 1 ms 596 KB Output is correct
94 Correct 1 ms 596 KB Output is correct
95 Correct 2 ms 3028 KB Output is correct
96 Correct 2 ms 3028 KB Output is correct
97 Correct 2 ms 3028 KB Output is correct
98 Correct 2 ms 3028 KB Output is correct
99 Correct 2 ms 3028 KB Output is correct
100 Correct 2 ms 3028 KB Output is correct
101 Correct 2 ms 2644 KB Output is correct
102 Correct 1 ms 596 KB Output is correct
103 Correct 2 ms 2644 KB Output is correct
104 Correct 1 ms 596 KB Output is correct
105 Correct 2 ms 2644 KB Output is correct
106 Correct 1 ms 596 KB Output is correct
107 Correct 1 ms 596 KB Output is correct
108 Correct 1 ms 596 KB Output is correct
109 Correct 2 ms 852 KB Output is correct
110 Correct 1 ms 724 KB Output is correct
111 Correct 1 ms 724 KB Output is correct
112 Correct 3 ms 2772 KB Output is correct
113 Correct 3 ms 2388 KB Output is correct
114 Correct 3 ms 2132 KB Output is correct
115 Correct 2 ms 2260 KB Output is correct
116 Correct 2 ms 2516 KB Output is correct
117 Correct 3 ms 2900 KB Output is correct
118 Correct 20 ms 4692 KB Output is correct
119 Correct 17 ms 5588 KB Output is correct
120 Correct 21 ms 6264 KB Output is correct
121 Correct 2 ms 980 KB Output is correct
122 Correct 2 ms 980 KB Output is correct
123 Correct 2 ms 980 KB Output is correct
124 Correct 2 ms 980 KB Output is correct
125 Correct 2 ms 980 KB Output is correct
126 Correct 3 ms 3156 KB Output is correct
127 Correct 3 ms 3156 KB Output is correct
128 Correct 4 ms 3156 KB Output is correct
129 Correct 4 ms 3156 KB Output is correct
130 Correct 4 ms 3156 KB Output is correct
131 Correct 3 ms 3156 KB Output is correct
132 Correct 25 ms 6652 KB Output is correct
133 Correct 25 ms 6624 KB Output is correct
134 Correct 27 ms 6636 KB Output is correct
135 Correct 9 ms 14164 KB Output is correct
136 Correct 140 ms 45124 KB Output is correct
137 Correct 97 ms 27596 KB Output is correct
138 Correct 76 ms 22128 KB Output is correct
139 Correct 82 ms 26824 KB Output is correct
140 Correct 54 ms 18252 KB Output is correct
141 Correct 17 ms 11348 KB Output is correct
142 Correct 15 ms 10324 KB Output is correct
143 Correct 27 ms 16404 KB Output is correct
144 Correct 15 ms 10452 KB Output is correct
145 Correct 17 ms 12372 KB Output is correct
146 Correct 14 ms 13396 KB Output is correct
147 Correct 23 ms 12208 KB Output is correct
148 Correct 9 ms 9328 KB Output is correct
149 Correct 25 ms 11960 KB Output is correct
150 Correct 8 ms 8916 KB Output is correct
151 Correct 31 ms 17876 KB Output is correct
152 Correct 12 ms 14316 KB Output is correct
153 Correct 11 ms 13012 KB Output is correct
154 Correct 14 ms 15828 KB Output is correct
155 Correct 10 ms 11884 KB Output is correct
156 Correct 12 ms 11860 KB Output is correct
157 Correct 9 ms 14312 KB Output is correct
158 Correct 202 ms 63464 KB Output is correct
159 Correct 169 ms 48716 KB Output is correct
160 Correct 138 ms 42352 KB Output is correct
161 Correct 119 ms 38528 KB Output is correct
162 Correct 106 ms 35868 KB Output is correct
163 Correct 25 ms 18044 KB Output is correct
164 Correct 29 ms 18008 KB Output is correct
165 Correct 30 ms 18008 KB Output is correct
166 Correct 25 ms 18004 KB Output is correct
167 Correct 23 ms 17996 KB Output is correct
168 Correct 26 ms 18012 KB Output is correct
169 Correct 39 ms 20140 KB Output is correct
170 Correct 14 ms 15364 KB Output is correct
171 Correct 39 ms 20172 KB Output is correct
172 Correct 15 ms 15412 KB Output is correct
173 Correct 38 ms 20196 KB Output is correct
174 Correct 14 ms 15444 KB Output is correct
175 Correct 15 ms 17492 KB Output is correct
176 Correct 16 ms 17376 KB Output is correct
177 Correct 16 ms 17364 KB Output is correct
178 Correct 15 ms 17296 KB Output is correct
179 Correct 27 ms 43348 KB Output is correct
180 Correct 787 ms 134364 KB Output is correct
181 Correct 482 ms 161220 KB Output is correct
182 Correct 654 ms 204864 KB Output is correct
183 Correct 298 ms 112920 KB Output is correct
184 Correct 242 ms 98844 KB Output is correct
185 Correct 41 ms 40544 KB Output is correct
186 Correct 46 ms 50612 KB Output is correct
187 Correct 52 ms 47976 KB Output is correct
188 Correct 83 ms 64596 KB Output is correct
189 Correct 58 ms 66180 KB Output is correct
190 Correct 66 ms 58664 KB Output is correct
191 Correct 60 ms 59656 KB Output is correct
192 Correct 51 ms 49300 KB Output is correct
193 Correct 45 ms 49636 KB Output is correct
194 Correct 42 ms 69812 KB Output is correct
195 Execution timed out 1604 ms 315112 KB Time limit exceeded
196 Halted 0 ms 0 KB -