답안 #724153

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724153 2023-04-14T18:38:52 Z danikoynov 벽 칠하기 (APIO20_paint) C++14
100 / 100
508 ms 504316 KB
#include "paint.h"

#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10, maxk = 1e5 + 10;

int dp[maxn], c[maxn], a[maxn / 2], n, m;
vector < int > b[maxn / 2], col[maxn];
vector < pair < int, unsigned int > > path[maxn];
int minimumInstructions(
    int N, int M, int K, vector<int> C,
    vector<int> A, vector<vector<int>> B)
{

    n = N;
    m = M;
    for (int i = 0; i < n; i ++)
    {
        c[i] = C[i];
    }

    for (int i = 0; i < m; i ++)
    {
        a[i] = A[i];
        for (int j = 0; j < a[i]; j ++)
        {
            b[i].push_back(B[i][j]);
            col[b[i][j]].push_back(i);
        }
    }

    for (int i = 0; i < N; i ++)
        dp[i] = 1e9;
    for (int i = N - 1; i >= 0; i --)
    {
        path[i].resize(col[c[i]].size());
        int to = 0;
        for (int idx : col[c[i]])
            path[i][to ++] = {idx, 1};
    }

    deque < pair < int, int > > dq;
    dq.push_back({N, 0});
    for (int i = N - 1; i >= 0; i --)
    {


        /**bool tf = false;
        for (int st = 0; st < M; st ++)
        {
            bool is_pos = true;
            for (int pos = 0; pos < M; pos ++)
            {
                if (col[c[i + pos]][(st + pos) % M] == 0)
                {
                    ///cout << "break " << pos << endl;
                    is_pos = false;
                    break;
                }
            }
            if (is_pos)
            {
                ///cout << i << " " << st << endl;
                tf = true;
                break;
            }
        }*/

        bool tf = false;
        int pt = 0;
        for (int j = 0; j < path[i].size(); j ++)
        {
            while(pt < path[i + 1].size() && path[i + 1][pt].first <= path[i][j].first)
                pt ++;

            if (pt != path[i + 1].size() && path[i + 1][pt].first == path[i][j].first + 1)
                path[i][j].second = max(path[i][j].second, min(path[i + 1][pt].second + 1, (unsigned)m));
            if (path[i][j].first == M - 1)
            {
                if (path[i + 1].size() > 0 && path[i + 1][0].first == 0)
                {
                    path[i][j].second = max(path[i][j].second, min(path[i + 1][0].second + 1, (unsigned)m));
                }
            }

            if (path[i][j].second == m)
                tf = true;

            ///cout << i << " : " << path[i][j].first << " " << path[i][j].second << endl;
        }



        while(!dq.empty() && dq.front().first > i + M)
            dq.pop_front();///, cout << "rem " << dq.front().first << endl;

        if (tf)
        {
            ///cout << "here " << i << " " << dq.front().first << endl;
            dp[i] = dq.front().second + 1;
            //for (int j = i + 1; j <= i + M; j ++)
            //  dp[i] = min(dp[i], dp[j] + 1);

        }

        while(!dq.empty() && dq.back().second >= dp[i])
            dq.pop_back();
        dq.push_back({i, dp[i]});
    }

    if (dp[0] > N)
        return -1;
    return dp[0];
}

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:72:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, unsigned int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |         for (int j = 0; j < path[i].size(); j ++)
      |                         ~~^~~~~~~~~~~~~~~~
paint.cpp:74:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, unsigned int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |             while(pt < path[i + 1].size() && path[i + 1][pt].first <= path[i][j].first)
      |                   ~~~^~~~~~~~~~~~~~~~~~~~
paint.cpp:77:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, unsigned int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |             if (pt != path[i + 1].size() && path[i + 1][pt].first == path[i][j].first + 1)
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~
paint.cpp:87:35: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
   87 |             if (path[i][j].second == m)
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6100 KB Output is correct
2 Correct 4 ms 6132 KB Output is correct
3 Correct 3 ms 6100 KB Output is correct
4 Correct 3 ms 6100 KB Output is correct
5 Correct 3 ms 6100 KB Output is correct
6 Correct 3 ms 6100 KB Output is correct
7 Correct 3 ms 6100 KB Output is correct
8 Correct 3 ms 6100 KB Output is correct
9 Correct 3 ms 6100 KB Output is correct
10 Correct 3 ms 6100 KB Output is correct
11 Correct 4 ms 6100 KB Output is correct
12 Correct 5 ms 6100 KB Output is correct
13 Correct 4 ms 6228 KB Output is correct
14 Correct 4 ms 6228 KB Output is correct
15 Correct 4 ms 6228 KB Output is correct
16 Correct 4 ms 6228 KB Output is correct
17 Correct 3 ms 6228 KB Output is correct
18 Correct 3 ms 6228 KB Output is correct
19 Correct 3 ms 6228 KB Output is correct
20 Correct 4 ms 6228 KB Output is correct
21 Correct 4 ms 6228 KB Output is correct
22 Correct 22 ms 10648 KB Output is correct
23 Correct 22 ms 10632 KB Output is correct
24 Correct 21 ms 10588 KB Output is correct
25 Correct 6 ms 6996 KB Output is correct
26 Correct 8 ms 7124 KB Output is correct
27 Correct 6 ms 7124 KB Output is correct
28 Correct 8 ms 7124 KB Output is correct
29 Correct 8 ms 7124 KB Output is correct
30 Correct 6 ms 7124 KB Output is correct
31 Correct 12 ms 8148 KB Output is correct
32 Correct 11 ms 8148 KB Output is correct
33 Correct 12 ms 8148 KB Output is correct
34 Correct 12 ms 8148 KB Output is correct
35 Correct 11 ms 8180 KB Output is correct
36 Correct 13 ms 8148 KB Output is correct
37 Correct 26 ms 11676 KB Output is correct
38 Correct 26 ms 11680 KB Output is correct
39 Correct 39 ms 11692 KB Output is correct
40 Correct 24 ms 10316 KB Output is correct
41 Correct 11 ms 8788 KB Output is correct
42 Correct 17 ms 10708 KB Output is correct
43 Correct 12 ms 9172 KB Output is correct
44 Correct 14 ms 8976 KB Output is correct
45 Correct 18 ms 10836 KB Output is correct
46 Correct 52 ms 20340 KB Output is correct
47 Correct 33 ms 14140 KB Output is correct
48 Correct 42 ms 17492 KB Output is correct
49 Correct 55 ms 17616 KB Output is correct
50 Correct 47 ms 17460 KB Output is correct
51 Correct 38 ms 14916 KB Output is correct
52 Correct 16 ms 10836 KB Output is correct
53 Correct 17 ms 10800 KB Output is correct
54 Correct 19 ms 10840 KB Output is correct
55 Correct 18 ms 10836 KB Output is correct
56 Correct 18 ms 10880 KB Output is correct
57 Correct 17 ms 10836 KB Output is correct
58 Correct 55 ms 21580 KB Output is correct
59 Correct 61 ms 21612 KB Output is correct
60 Correct 57 ms 21584 KB Output is correct
61 Correct 60 ms 21500 KB Output is correct
62 Correct 56 ms 21544 KB Output is correct
63 Correct 53 ms 21524 KB Output is correct
64 Correct 60 ms 20584 KB Output is correct
65 Correct 55 ms 20652 KB Output is correct
66 Correct 60 ms 20576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6100 KB Output is correct
2 Correct 4 ms 6132 KB Output is correct
3 Correct 3 ms 6100 KB Output is correct
4 Correct 3 ms 6100 KB Output is correct
5 Correct 3 ms 6100 KB Output is correct
6 Correct 3 ms 6100 KB Output is correct
7 Correct 3 ms 6100 KB Output is correct
8 Correct 3 ms 6100 KB Output is correct
9 Correct 3 ms 6100 KB Output is correct
10 Correct 3 ms 6100 KB Output is correct
11 Correct 4 ms 6100 KB Output is correct
12 Correct 5 ms 6100 KB Output is correct
13 Correct 4 ms 6228 KB Output is correct
14 Correct 4 ms 6228 KB Output is correct
15 Correct 4 ms 6228 KB Output is correct
16 Correct 4 ms 6228 KB Output is correct
17 Correct 3 ms 6228 KB Output is correct
18 Correct 3 ms 6228 KB Output is correct
19 Correct 3 ms 6228 KB Output is correct
20 Correct 4 ms 6228 KB Output is correct
21 Correct 4 ms 6228 KB Output is correct
22 Correct 4 ms 6100 KB Output is correct
23 Correct 4 ms 6100 KB Output is correct
24 Correct 3 ms 6100 KB Output is correct
25 Correct 5 ms 6100 KB Output is correct
26 Correct 3 ms 6100 KB Output is correct
27 Correct 4 ms 6100 KB Output is correct
28 Correct 4 ms 6228 KB Output is correct
29 Correct 3 ms 6228 KB Output is correct
30 Correct 4 ms 6228 KB Output is correct
31 Correct 3 ms 6228 KB Output is correct
32 Correct 3 ms 6228 KB Output is correct
33 Correct 3 ms 6228 KB Output is correct
34 Correct 3 ms 6228 KB Output is correct
35 Correct 4 ms 6228 KB Output is correct
36 Correct 3 ms 6228 KB Output is correct
37 Correct 4 ms 6228 KB Output is correct
38 Correct 5 ms 6228 KB Output is correct
39 Correct 4 ms 6100 KB Output is correct
40 Correct 4 ms 6228 KB Output is correct
41 Correct 3 ms 6228 KB Output is correct
42 Correct 4 ms 6228 KB Output is correct
43 Correct 4 ms 6100 KB Output is correct
44 Correct 3 ms 6100 KB Output is correct
45 Correct 4 ms 6228 KB Output is correct
46 Correct 4 ms 6228 KB Output is correct
47 Correct 4 ms 6216 KB Output is correct
48 Correct 4 ms 6228 KB Output is correct
49 Correct 4 ms 6228 KB Output is correct
50 Correct 3 ms 6228 KB Output is correct
51 Correct 3 ms 6228 KB Output is correct
52 Correct 3 ms 6228 KB Output is correct
53 Correct 3 ms 6228 KB Output is correct
54 Correct 4 ms 6228 KB Output is correct
55 Correct 3 ms 6228 KB Output is correct
56 Correct 3 ms 6228 KB Output is correct
57 Correct 4 ms 6228 KB Output is correct
58 Correct 3 ms 6228 KB Output is correct
59 Correct 4 ms 6228 KB Output is correct
60 Correct 4 ms 6228 KB Output is correct
61 Correct 4 ms 6228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6100 KB Output is correct
2 Correct 4 ms 6100 KB Output is correct
3 Correct 3 ms 6100 KB Output is correct
4 Correct 4 ms 6132 KB Output is correct
5 Correct 3 ms 6100 KB Output is correct
6 Correct 3 ms 6100 KB Output is correct
7 Correct 3 ms 6100 KB Output is correct
8 Correct 3 ms 6100 KB Output is correct
9 Correct 3 ms 6100 KB Output is correct
10 Correct 3 ms 6100 KB Output is correct
11 Correct 3 ms 6100 KB Output is correct
12 Correct 3 ms 6100 KB Output is correct
13 Correct 4 ms 6100 KB Output is correct
14 Correct 5 ms 6100 KB Output is correct
15 Correct 4 ms 6228 KB Output is correct
16 Correct 4 ms 6228 KB Output is correct
17 Correct 4 ms 6228 KB Output is correct
18 Correct 4 ms 6228 KB Output is correct
19 Correct 3 ms 6228 KB Output is correct
20 Correct 3 ms 6228 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 4 ms 6228 KB Output is correct
23 Correct 4 ms 6228 KB Output is correct
24 Correct 22 ms 10648 KB Output is correct
25 Correct 22 ms 10632 KB Output is correct
26 Correct 21 ms 10588 KB Output is correct
27 Correct 3 ms 6100 KB Output is correct
28 Correct 5 ms 6100 KB Output is correct
29 Correct 3 ms 6100 KB Output is correct
30 Correct 4 ms 6100 KB Output is correct
31 Correct 4 ms 6228 KB Output is correct
32 Correct 3 ms 6228 KB Output is correct
33 Correct 4 ms 6228 KB Output is correct
34 Correct 3 ms 6228 KB Output is correct
35 Correct 3 ms 6228 KB Output is correct
36 Correct 3 ms 6228 KB Output is correct
37 Correct 3 ms 6228 KB Output is correct
38 Correct 4 ms 6228 KB Output is correct
39 Correct 3 ms 6228 KB Output is correct
40 Correct 4 ms 6228 KB Output is correct
41 Correct 5 ms 6228 KB Output is correct
42 Correct 4 ms 6100 KB Output is correct
43 Correct 4 ms 6228 KB Output is correct
44 Correct 3 ms 6228 KB Output is correct
45 Correct 4 ms 6228 KB Output is correct
46 Correct 4 ms 6100 KB Output is correct
47 Correct 3 ms 6100 KB Output is correct
48 Correct 4 ms 6228 KB Output is correct
49 Correct 4 ms 6228 KB Output is correct
50 Correct 4 ms 6216 KB Output is correct
51 Correct 4 ms 6228 KB Output is correct
52 Correct 4 ms 6228 KB Output is correct
53 Correct 3 ms 6228 KB Output is correct
54 Correct 3 ms 6228 KB Output is correct
55 Correct 3 ms 6228 KB Output is correct
56 Correct 3 ms 6228 KB Output is correct
57 Correct 4 ms 6228 KB Output is correct
58 Correct 3 ms 6228 KB Output is correct
59 Correct 3 ms 6228 KB Output is correct
60 Correct 4 ms 6228 KB Output is correct
61 Correct 3 ms 6228 KB Output is correct
62 Correct 4 ms 6228 KB Output is correct
63 Correct 4 ms 6228 KB Output is correct
64 Correct 4 ms 6228 KB Output is correct
65 Correct 4 ms 6484 KB Output is correct
66 Correct 4 ms 6356 KB Output is correct
67 Correct 6 ms 6592 KB Output is correct
68 Correct 5 ms 6452 KB Output is correct
69 Correct 3 ms 6612 KB Output is correct
70 Correct 5 ms 6416 KB Output is correct
71 Correct 5 ms 6452 KB Output is correct
72 Correct 5 ms 6484 KB Output is correct
73 Correct 5 ms 6356 KB Output is correct
74 Correct 5 ms 6484 KB Output is correct
75 Correct 4 ms 6356 KB Output is correct
76 Correct 22 ms 9284 KB Output is correct
77 Correct 20 ms 9876 KB Output is correct
78 Correct 26 ms 10364 KB Output is correct
79 Correct 4 ms 6996 KB Output is correct
80 Correct 4 ms 6996 KB Output is correct
81 Correct 4 ms 6996 KB Output is correct
82 Correct 4 ms 6996 KB Output is correct
83 Correct 4 ms 6996 KB Output is correct
84 Correct 6 ms 6612 KB Output is correct
85 Correct 5 ms 6612 KB Output is correct
86 Correct 5 ms 6612 KB Output is correct
87 Correct 6 ms 6596 KB Output is correct
88 Correct 6 ms 6612 KB Output is correct
89 Correct 5 ms 6612 KB Output is correct
90 Correct 30 ms 10708 KB Output is correct
91 Correct 31 ms 10700 KB Output is correct
92 Correct 42 ms 10700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6100 KB Output is correct
2 Correct 4 ms 6100 KB Output is correct
3 Correct 3 ms 6100 KB Output is correct
4 Correct 4 ms 6132 KB Output is correct
5 Correct 3 ms 6100 KB Output is correct
6 Correct 3 ms 6100 KB Output is correct
7 Correct 3 ms 6100 KB Output is correct
8 Correct 3 ms 6100 KB Output is correct
9 Correct 3 ms 6100 KB Output is correct
10 Correct 3 ms 6100 KB Output is correct
11 Correct 3 ms 6100 KB Output is correct
12 Correct 3 ms 6100 KB Output is correct
13 Correct 4 ms 6100 KB Output is correct
14 Correct 5 ms 6100 KB Output is correct
15 Correct 4 ms 6228 KB Output is correct
16 Correct 4 ms 6228 KB Output is correct
17 Correct 4 ms 6228 KB Output is correct
18 Correct 4 ms 6228 KB Output is correct
19 Correct 3 ms 6228 KB Output is correct
20 Correct 3 ms 6228 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 4 ms 6228 KB Output is correct
23 Correct 4 ms 6228 KB Output is correct
24 Correct 22 ms 10648 KB Output is correct
25 Correct 22 ms 10632 KB Output is correct
26 Correct 21 ms 10588 KB Output is correct
27 Correct 6 ms 6996 KB Output is correct
28 Correct 8 ms 7124 KB Output is correct
29 Correct 6 ms 7124 KB Output is correct
30 Correct 8 ms 7124 KB Output is correct
31 Correct 8 ms 7124 KB Output is correct
32 Correct 6 ms 7124 KB Output is correct
33 Correct 12 ms 8148 KB Output is correct
34 Correct 11 ms 8148 KB Output is correct
35 Correct 12 ms 8148 KB Output is correct
36 Correct 12 ms 8148 KB Output is correct
37 Correct 11 ms 8180 KB Output is correct
38 Correct 13 ms 8148 KB Output is correct
39 Correct 26 ms 11676 KB Output is correct
40 Correct 26 ms 11680 KB Output is correct
41 Correct 39 ms 11692 KB Output is correct
42 Correct 3 ms 6100 KB Output is correct
43 Correct 5 ms 6100 KB Output is correct
44 Correct 3 ms 6100 KB Output is correct
45 Correct 4 ms 6100 KB Output is correct
46 Correct 4 ms 6228 KB Output is correct
47 Correct 3 ms 6228 KB Output is correct
48 Correct 4 ms 6228 KB Output is correct
49 Correct 3 ms 6228 KB Output is correct
50 Correct 3 ms 6228 KB Output is correct
51 Correct 3 ms 6228 KB Output is correct
52 Correct 3 ms 6228 KB Output is correct
53 Correct 4 ms 6228 KB Output is correct
54 Correct 3 ms 6228 KB Output is correct
55 Correct 4 ms 6228 KB Output is correct
56 Correct 5 ms 6228 KB Output is correct
57 Correct 4 ms 6100 KB Output is correct
58 Correct 4 ms 6228 KB Output is correct
59 Correct 3 ms 6228 KB Output is correct
60 Correct 4 ms 6228 KB Output is correct
61 Correct 4 ms 6100 KB Output is correct
62 Correct 3 ms 6100 KB Output is correct
63 Correct 4 ms 6228 KB Output is correct
64 Correct 4 ms 6228 KB Output is correct
65 Correct 4 ms 6216 KB Output is correct
66 Correct 4 ms 6228 KB Output is correct
67 Correct 4 ms 6228 KB Output is correct
68 Correct 3 ms 6228 KB Output is correct
69 Correct 3 ms 6228 KB Output is correct
70 Correct 3 ms 6228 KB Output is correct
71 Correct 3 ms 6228 KB Output is correct
72 Correct 4 ms 6228 KB Output is correct
73 Correct 3 ms 6228 KB Output is correct
74 Correct 3 ms 6228 KB Output is correct
75 Correct 4 ms 6228 KB Output is correct
76 Correct 3 ms 6228 KB Output is correct
77 Correct 4 ms 6228 KB Output is correct
78 Correct 4 ms 6228 KB Output is correct
79 Correct 4 ms 6228 KB Output is correct
80 Correct 4 ms 6484 KB Output is correct
81 Correct 4 ms 6356 KB Output is correct
82 Correct 6 ms 6592 KB Output is correct
83 Correct 5 ms 6452 KB Output is correct
84 Correct 3 ms 6612 KB Output is correct
85 Correct 5 ms 6416 KB Output is correct
86 Correct 5 ms 6452 KB Output is correct
87 Correct 5 ms 6484 KB Output is correct
88 Correct 5 ms 6356 KB Output is correct
89 Correct 5 ms 6484 KB Output is correct
90 Correct 4 ms 6356 KB Output is correct
91 Correct 22 ms 9284 KB Output is correct
92 Correct 20 ms 9876 KB Output is correct
93 Correct 26 ms 10364 KB Output is correct
94 Correct 4 ms 6996 KB Output is correct
95 Correct 4 ms 6996 KB Output is correct
96 Correct 4 ms 6996 KB Output is correct
97 Correct 4 ms 6996 KB Output is correct
98 Correct 4 ms 6996 KB Output is correct
99 Correct 6 ms 6612 KB Output is correct
100 Correct 5 ms 6612 KB Output is correct
101 Correct 5 ms 6612 KB Output is correct
102 Correct 6 ms 6596 KB Output is correct
103 Correct 6 ms 6612 KB Output is correct
104 Correct 5 ms 6612 KB Output is correct
105 Correct 30 ms 10708 KB Output is correct
106 Correct 31 ms 10700 KB Output is correct
107 Correct 42 ms 10700 KB Output is correct
108 Correct 7 ms 6996 KB Output is correct
109 Correct 66 ms 76884 KB Output is correct
110 Correct 57 ms 44500 KB Output is correct
111 Correct 47 ms 34712 KB Output is correct
112 Correct 60 ms 38980 KB Output is correct
113 Correct 42 ms 27896 KB Output is correct
114 Correct 20 ms 8248 KB Output is correct
115 Correct 15 ms 8164 KB Output is correct
116 Correct 23 ms 8788 KB Output is correct
117 Correct 15 ms 8224 KB Output is correct
118 Correct 16 ms 8404 KB Output is correct
119 Correct 14 ms 7900 KB Output is correct
120 Correct 21 ms 9564 KB Output is correct
121 Correct 9 ms 7252 KB Output is correct
122 Correct 27 ms 9796 KB Output is correct
123 Correct 18 ms 7112 KB Output is correct
124 Correct 30 ms 10568 KB Output is correct
125 Correct 13 ms 7764 KB Output is correct
126 Correct 14 ms 7700 KB Output is correct
127 Correct 15 ms 8020 KB Output is correct
128 Correct 9 ms 7508 KB Output is correct
129 Correct 9 ms 7508 KB Output is correct
130 Correct 7 ms 7124 KB Output is correct
131 Correct 101 ms 105804 KB Output is correct
132 Correct 102 ms 76648 KB Output is correct
133 Correct 93 ms 63948 KB Output is correct
134 Correct 94 ms 56240 KB Output is correct
135 Correct 83 ms 51000 KB Output is correct
136 Correct 22 ms 9300 KB Output is correct
137 Correct 22 ms 9400 KB Output is correct
138 Correct 22 ms 9316 KB Output is correct
139 Correct 23 ms 9292 KB Output is correct
140 Correct 22 ms 9328 KB Output is correct
141 Correct 21 ms 9300 KB Output is correct
142 Correct 54 ms 11900 KB Output is correct
143 Correct 13 ms 8008 KB Output is correct
144 Correct 38 ms 11860 KB Output is correct
145 Correct 11 ms 7892 KB Output is correct
146 Correct 38 ms 11884 KB Output is correct
147 Correct 11 ms 7900 KB Output is correct
148 Correct 14 ms 8336 KB Output is correct
149 Correct 12 ms 8184 KB Output is correct
150 Correct 12 ms 8128 KB Output is correct
151 Correct 13 ms 8032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6100 KB Output is correct
2 Correct 4 ms 6100 KB Output is correct
3 Correct 3 ms 6100 KB Output is correct
4 Correct 4 ms 6132 KB Output is correct
5 Correct 3 ms 6100 KB Output is correct
6 Correct 3 ms 6100 KB Output is correct
7 Correct 3 ms 6100 KB Output is correct
8 Correct 3 ms 6100 KB Output is correct
9 Correct 3 ms 6100 KB Output is correct
10 Correct 3 ms 6100 KB Output is correct
11 Correct 3 ms 6100 KB Output is correct
12 Correct 3 ms 6100 KB Output is correct
13 Correct 4 ms 6100 KB Output is correct
14 Correct 5 ms 6100 KB Output is correct
15 Correct 4 ms 6228 KB Output is correct
16 Correct 4 ms 6228 KB Output is correct
17 Correct 4 ms 6228 KB Output is correct
18 Correct 4 ms 6228 KB Output is correct
19 Correct 3 ms 6228 KB Output is correct
20 Correct 3 ms 6228 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 4 ms 6228 KB Output is correct
23 Correct 4 ms 6228 KB Output is correct
24 Correct 22 ms 10648 KB Output is correct
25 Correct 22 ms 10632 KB Output is correct
26 Correct 21 ms 10588 KB Output is correct
27 Correct 6 ms 6996 KB Output is correct
28 Correct 8 ms 7124 KB Output is correct
29 Correct 6 ms 7124 KB Output is correct
30 Correct 8 ms 7124 KB Output is correct
31 Correct 8 ms 7124 KB Output is correct
32 Correct 6 ms 7124 KB Output is correct
33 Correct 12 ms 8148 KB Output is correct
34 Correct 11 ms 8148 KB Output is correct
35 Correct 12 ms 8148 KB Output is correct
36 Correct 12 ms 8148 KB Output is correct
37 Correct 11 ms 8180 KB Output is correct
38 Correct 13 ms 8148 KB Output is correct
39 Correct 26 ms 11676 KB Output is correct
40 Correct 26 ms 11680 KB Output is correct
41 Correct 39 ms 11692 KB Output is correct
42 Correct 24 ms 10316 KB Output is correct
43 Correct 11 ms 8788 KB Output is correct
44 Correct 17 ms 10708 KB Output is correct
45 Correct 12 ms 9172 KB Output is correct
46 Correct 14 ms 8976 KB Output is correct
47 Correct 18 ms 10836 KB Output is correct
48 Correct 52 ms 20340 KB Output is correct
49 Correct 33 ms 14140 KB Output is correct
50 Correct 42 ms 17492 KB Output is correct
51 Correct 55 ms 17616 KB Output is correct
52 Correct 47 ms 17460 KB Output is correct
53 Correct 38 ms 14916 KB Output is correct
54 Correct 16 ms 10836 KB Output is correct
55 Correct 17 ms 10800 KB Output is correct
56 Correct 19 ms 10840 KB Output is correct
57 Correct 18 ms 10836 KB Output is correct
58 Correct 18 ms 10880 KB Output is correct
59 Correct 17 ms 10836 KB Output is correct
60 Correct 55 ms 21580 KB Output is correct
61 Correct 61 ms 21612 KB Output is correct
62 Correct 57 ms 21584 KB Output is correct
63 Correct 60 ms 21500 KB Output is correct
64 Correct 56 ms 21544 KB Output is correct
65 Correct 53 ms 21524 KB Output is correct
66 Correct 60 ms 20584 KB Output is correct
67 Correct 55 ms 20652 KB Output is correct
68 Correct 60 ms 20576 KB Output is correct
69 Correct 3 ms 6100 KB Output is correct
70 Correct 5 ms 6100 KB Output is correct
71 Correct 3 ms 6100 KB Output is correct
72 Correct 4 ms 6100 KB Output is correct
73 Correct 4 ms 6228 KB Output is correct
74 Correct 3 ms 6228 KB Output is correct
75 Correct 4 ms 6228 KB Output is correct
76 Correct 3 ms 6228 KB Output is correct
77 Correct 3 ms 6228 KB Output is correct
78 Correct 3 ms 6228 KB Output is correct
79 Correct 3 ms 6228 KB Output is correct
80 Correct 4 ms 6228 KB Output is correct
81 Correct 3 ms 6228 KB Output is correct
82 Correct 4 ms 6228 KB Output is correct
83 Correct 5 ms 6228 KB Output is correct
84 Correct 4 ms 6100 KB Output is correct
85 Correct 4 ms 6228 KB Output is correct
86 Correct 3 ms 6228 KB Output is correct
87 Correct 4 ms 6228 KB Output is correct
88 Correct 4 ms 6100 KB Output is correct
89 Correct 3 ms 6100 KB Output is correct
90 Correct 4 ms 6228 KB Output is correct
91 Correct 4 ms 6228 KB Output is correct
92 Correct 4 ms 6216 KB Output is correct
93 Correct 4 ms 6228 KB Output is correct
94 Correct 4 ms 6228 KB Output is correct
95 Correct 3 ms 6228 KB Output is correct
96 Correct 3 ms 6228 KB Output is correct
97 Correct 3 ms 6228 KB Output is correct
98 Correct 3 ms 6228 KB Output is correct
99 Correct 4 ms 6228 KB Output is correct
100 Correct 3 ms 6228 KB Output is correct
101 Correct 3 ms 6228 KB Output is correct
102 Correct 4 ms 6228 KB Output is correct
103 Correct 3 ms 6228 KB Output is correct
104 Correct 4 ms 6228 KB Output is correct
105 Correct 4 ms 6228 KB Output is correct
106 Correct 4 ms 6228 KB Output is correct
107 Correct 4 ms 6484 KB Output is correct
108 Correct 4 ms 6356 KB Output is correct
109 Correct 6 ms 6592 KB Output is correct
110 Correct 5 ms 6452 KB Output is correct
111 Correct 3 ms 6612 KB Output is correct
112 Correct 5 ms 6416 KB Output is correct
113 Correct 5 ms 6452 KB Output is correct
114 Correct 5 ms 6484 KB Output is correct
115 Correct 5 ms 6356 KB Output is correct
116 Correct 5 ms 6484 KB Output is correct
117 Correct 4 ms 6356 KB Output is correct
118 Correct 22 ms 9284 KB Output is correct
119 Correct 20 ms 9876 KB Output is correct
120 Correct 26 ms 10364 KB Output is correct
121 Correct 4 ms 6996 KB Output is correct
122 Correct 4 ms 6996 KB Output is correct
123 Correct 4 ms 6996 KB Output is correct
124 Correct 4 ms 6996 KB Output is correct
125 Correct 4 ms 6996 KB Output is correct
126 Correct 6 ms 6612 KB Output is correct
127 Correct 5 ms 6612 KB Output is correct
128 Correct 5 ms 6612 KB Output is correct
129 Correct 6 ms 6596 KB Output is correct
130 Correct 6 ms 6612 KB Output is correct
131 Correct 5 ms 6612 KB Output is correct
132 Correct 30 ms 10708 KB Output is correct
133 Correct 31 ms 10700 KB Output is correct
134 Correct 42 ms 10700 KB Output is correct
135 Correct 7 ms 6996 KB Output is correct
136 Correct 66 ms 76884 KB Output is correct
137 Correct 57 ms 44500 KB Output is correct
138 Correct 47 ms 34712 KB Output is correct
139 Correct 60 ms 38980 KB Output is correct
140 Correct 42 ms 27896 KB Output is correct
141 Correct 20 ms 8248 KB Output is correct
142 Correct 15 ms 8164 KB Output is correct
143 Correct 23 ms 8788 KB Output is correct
144 Correct 15 ms 8224 KB Output is correct
145 Correct 16 ms 8404 KB Output is correct
146 Correct 14 ms 7900 KB Output is correct
147 Correct 21 ms 9564 KB Output is correct
148 Correct 9 ms 7252 KB Output is correct
149 Correct 27 ms 9796 KB Output is correct
150 Correct 18 ms 7112 KB Output is correct
151 Correct 30 ms 10568 KB Output is correct
152 Correct 13 ms 7764 KB Output is correct
153 Correct 14 ms 7700 KB Output is correct
154 Correct 15 ms 8020 KB Output is correct
155 Correct 9 ms 7508 KB Output is correct
156 Correct 9 ms 7508 KB Output is correct
157 Correct 7 ms 7124 KB Output is correct
158 Correct 101 ms 105804 KB Output is correct
159 Correct 102 ms 76648 KB Output is correct
160 Correct 93 ms 63948 KB Output is correct
161 Correct 94 ms 56240 KB Output is correct
162 Correct 83 ms 51000 KB Output is correct
163 Correct 22 ms 9300 KB Output is correct
164 Correct 22 ms 9400 KB Output is correct
165 Correct 22 ms 9316 KB Output is correct
166 Correct 23 ms 9292 KB Output is correct
167 Correct 22 ms 9328 KB Output is correct
168 Correct 21 ms 9300 KB Output is correct
169 Correct 54 ms 11900 KB Output is correct
170 Correct 13 ms 8008 KB Output is correct
171 Correct 38 ms 11860 KB Output is correct
172 Correct 11 ms 7892 KB Output is correct
173 Correct 38 ms 11884 KB Output is correct
174 Correct 11 ms 7900 KB Output is correct
175 Correct 14 ms 8336 KB Output is correct
176 Correct 12 ms 8184 KB Output is correct
177 Correct 12 ms 8128 KB Output is correct
178 Correct 13 ms 8032 KB Output is correct
179 Correct 13 ms 9044 KB Output is correct
180 Correct 189 ms 205844 KB Output is correct
181 Correct 296 ms 230092 KB Output is correct
182 Correct 408 ms 285152 KB Output is correct
183 Correct 222 ms 146348 KB Output is correct
184 Correct 186 ms 120832 KB Output is correct
185 Correct 33 ms 12188 KB Output is correct
186 Correct 37 ms 14132 KB Output is correct
187 Correct 58 ms 13316 KB Output is correct
188 Correct 40 ms 13080 KB Output is correct
189 Correct 42 ms 13520 KB Output is correct
190 Correct 44 ms 14540 KB Output is correct
191 Correct 39 ms 14232 KB Output is correct
192 Correct 33 ms 11492 KB Output is correct
193 Correct 27 ms 11624 KB Output is correct
194 Correct 19 ms 10788 KB Output is correct
195 Correct 499 ms 504316 KB Output is correct
196 Correct 508 ms 358716 KB Output is correct
197 Correct 418 ms 295132 KB Output is correct
198 Correct 414 ms 256724 KB Output is correct
199 Correct 387 ms 230476 KB Output is correct
200 Correct 78 ms 23340 KB Output is correct
201 Correct 76 ms 23448 KB Output is correct
202 Correct 77 ms 23460 KB Output is correct
203 Correct 82 ms 23408 KB Output is correct
204 Correct 83 ms 23344 KB Output is correct
205 Correct 79 ms 23396 KB Output is correct
206 Correct 80 ms 21940 KB Output is correct
207 Correct 62 ms 21840 KB Output is correct
208 Correct 73 ms 21848 KB Output is correct
209 Correct 62 ms 21752 KB Output is correct
210 Correct 81 ms 21924 KB Output is correct
211 Correct 68 ms 21800 KB Output is correct
212 Correct 74 ms 23120 KB Output is correct
213 Correct 63 ms 19704 KB Output is correct
214 Correct 61 ms 19268 KB Output is correct
215 Correct 60 ms 18720 KB Output is correct