Submission #1023233

# Submission time Handle Problem Language Result Execution time Memory
1023233 2024-07-14T13:47:49 Z snpmrnhlol Maze (JOI23_ho_t3) C++17
94 / 100
2000 ms 875156 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 6e6;
const int inf = 2e9;
vector <vector<char>> v;
vector <vector<int>> dist;
vector <vector<vector<bool>>> vis;
int k,n,m,sx,sy,ex,ey;
bool inbound(int x,int y){
    return 0 <= x && x < n && 0 <= y && y < m;
}
queue <array<int,2>> q[2];
queue <array<int,3>> q2;
int d[8][2] = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
int main(){
    cin>>n>>m>>k;
    cin>>sx>>sy>>ex>>ey;
    sx--;sy--;ex--;ey--;
    dist.assign(n,vector<int>(m,inf));
    v.assign(n,vector<char>(m,0));
    vis.assign(n,vector<vector<bool>>(m,vector<bool>({0,0})));
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            cin>>v[i][j];
        }
    }
    vis[sx][sy][0] = 1;
    q[0].push({sx,sy});
    for(int i = 0;i <= n + m;i++){
        while(!q[i%2].empty()){
            auto x = q[i%2].front();
            dist[x[0]][x[1]] = i;
            //cout<<x[0]<<' '<<x[1]<<' '<<i<<'\n';
            q[i%2].pop();
            ///bfs
            if(!vis[x[0]][x[1]][1]){
                q2.push({x[0],x[1],0});
            }
            for(int j = 0;j < 4;j++){
                int nx = x[0] + d[j][0];
                int ny = x[1] + d[j][1];
                if(inbound(nx,ny) && !vis[nx][ny][0] && v[nx][ny] == '.'){
                    vis[nx][ny][0] = 1;
                    q[i%2].push({nx,ny});
                }
            }
        }
        while(!q2.empty()){
            auto x = q2.front();
            q2.pop();
            if(!vis[x[0]][x[1]][0]){
                q[(i%2)^1].push({x[0],x[1]});
                vis[x[0]][x[1]][0] = 1;
            }
            if(x[2] != k - 1){
                for(int j = 0;j < 8;j++){
                    int nx = x[0] + d[j][0];
                    int ny = x[1] + d[j][1];
                    if(inbound(nx,ny) && !vis[nx][ny][1]){
                        vis[nx][ny][1] = 1;
                        q2.push({nx,ny,x[2] + 1});
                    }
                }
            }else{
                for(int j = 0;j < 4;j++){
                    int nx = x[0] + d[j][0];
                    int ny = x[1] + d[j][1];
                    if(inbound(nx,ny) && !vis[nx][ny][0]){
                        vis[nx][ny][0] = 1;
                        q[(i%2)^1].push({nx,ny});
                    }
                    //cout<<nx<<' '<<ny<<"whatthefuckiswrong\n";
                }
            }
        }
    }
    cout<<dist[ex][ey];
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 14 ms 4952 KB Output is correct
20 Correct 8 ms 7328 KB Output is correct
21 Correct 9 ms 5724 KB Output is correct
22 Correct 10 ms 5060 KB Output is correct
23 Correct 8 ms 4956 KB Output is correct
24 Correct 11 ms 9072 KB Output is correct
25 Correct 12 ms 9072 KB Output is correct
26 Correct 10 ms 5128 KB Output is correct
27 Correct 10 ms 5044 KB Output is correct
28 Correct 8 ms 4956 KB Output is correct
29 Correct 23 ms 11712 KB Output is correct
30 Correct 11 ms 7004 KB Output is correct
31 Correct 23 ms 13656 KB Output is correct
32 Correct 30 ms 12120 KB Output is correct
33 Correct 22 ms 11868 KB Output is correct
34 Correct 27 ms 22144 KB Output is correct
35 Correct 27 ms 22288 KB Output is correct
36 Correct 28 ms 11868 KB Output is correct
37 Correct 30 ms 11892 KB Output is correct
38 Correct 25 ms 11864 KB Output is correct
39 Correct 308 ms 115028 KB Output is correct
40 Correct 26 ms 13916 KB Output is correct
41 Correct 35 ms 27320 KB Output is correct
42 Correct 39 ms 16728 KB Output is correct
43 Correct 39 ms 27260 KB Output is correct
44 Correct 115 ms 64880 KB Output is correct
45 Correct 127 ms 71948 KB Output is correct
46 Correct 280 ms 132868 KB Output is correct
47 Correct 343 ms 115104 KB Output is correct
48 Correct 358 ms 115024 KB Output is correct
49 Correct 313 ms 219044 KB Output is correct
50 Correct 310 ms 218976 KB Output is correct
51 Correct 411 ms 115548 KB Output is correct
52 Correct 397 ms 115480 KB Output is correct
53 Correct 365 ms 114832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 548 KB Output is correct
18 Correct 0 ms 440 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 436 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 420 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 7 ms 3388 KB Output is correct
26 Correct 10 ms 4960 KB Output is correct
27 Correct 12 ms 5556 KB Output is correct
28 Correct 12 ms 5556 KB Output is correct
29 Correct 9 ms 5468 KB Output is correct
30 Correct 8 ms 5468 KB Output is correct
31 Correct 9 ms 4956 KB Output is correct
32 Correct 11 ms 4952 KB Output is correct
33 Correct 13 ms 4956 KB Output is correct
34 Correct 25 ms 11120 KB Output is correct
35 Correct 22 ms 13660 KB Output is correct
36 Correct 30 ms 13736 KB Output is correct
37 Correct 23 ms 13192 KB Output is correct
38 Correct 21 ms 13148 KB Output is correct
39 Correct 133 ms 38784 KB Output is correct
40 Correct 404 ms 112940 KB Output is correct
41 Correct 299 ms 132872 KB Output is correct
42 Correct 338 ms 133120 KB Output is correct
43 Correct 320 ms 127220 KB Output is correct
44 Correct 312 ms 127108 KB Output is correct
45 Correct 448 ms 132644 KB Output is correct
46 Correct 422 ms 132996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 548 KB Output is correct
18 Correct 0 ms 440 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 11 ms 4952 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 936 KB Output is correct
36 Correct 6 ms 3160 KB Output is correct
37 Correct 9 ms 7076 KB Output is correct
38 Correct 12 ms 5144 KB Output is correct
39 Correct 11 ms 5724 KB Output is correct
40 Correct 10 ms 5040 KB Output is correct
41 Correct 8 ms 4956 KB Output is correct
42 Correct 13 ms 5796 KB Output is correct
43 Correct 8 ms 5532 KB Output is correct
44 Correct 9 ms 5468 KB Output is correct
45 Correct 11 ms 9056 KB Output is correct
46 Correct 12 ms 9068 KB Output is correct
47 Correct 11 ms 7004 KB Output is correct
48 Correct 11 ms 5212 KB Output is correct
49 Correct 10 ms 4956 KB Output is correct
50 Correct 9 ms 4956 KB Output is correct
51 Correct 8 ms 5084 KB Output is correct
52 Correct 11 ms 4956 KB Output is correct
53 Correct 14 ms 4956 KB Output is correct
54 Correct 9 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 548 KB Output is correct
18 Correct 0 ms 440 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 11 ms 4952 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 936 KB Output is correct
36 Correct 6 ms 3160 KB Output is correct
37 Correct 9 ms 7076 KB Output is correct
38 Correct 12 ms 5144 KB Output is correct
39 Correct 11 ms 5724 KB Output is correct
40 Correct 10 ms 5040 KB Output is correct
41 Correct 8 ms 4956 KB Output is correct
42 Correct 13 ms 5796 KB Output is correct
43 Correct 8 ms 5532 KB Output is correct
44 Correct 9 ms 5468 KB Output is correct
45 Correct 11 ms 9056 KB Output is correct
46 Correct 12 ms 9068 KB Output is correct
47 Correct 11 ms 7004 KB Output is correct
48 Correct 11 ms 5212 KB Output is correct
49 Correct 10 ms 4956 KB Output is correct
50 Correct 9 ms 4956 KB Output is correct
51 Correct 8 ms 5084 KB Output is correct
52 Correct 11 ms 4956 KB Output is correct
53 Correct 14 ms 4956 KB Output is correct
54 Correct 9 ms 4956 KB Output is correct
55 Correct 27 ms 11868 KB Output is correct
56 Correct 11 ms 7004 KB Output is correct
57 Correct 29 ms 10996 KB Output is correct
58 Correct 31 ms 11356 KB Output is correct
59 Correct 22 ms 13656 KB Output is correct
60 Correct 36 ms 11936 KB Output is correct
61 Correct 26 ms 11908 KB Output is correct
62 Correct 36 ms 13660 KB Output is correct
63 Correct 23 ms 13144 KB Output is correct
64 Correct 26 ms 13144 KB Output is correct
65 Correct 30 ms 22272 KB Output is correct
66 Correct 37 ms 22276 KB Output is correct
67 Correct 26 ms 16988 KB Output is correct
68 Correct 22 ms 12124 KB Output is correct
69 Correct 29 ms 12124 KB Output is correct
70 Correct 25 ms 12084 KB Output is correct
71 Correct 23 ms 12024 KB Output is correct
72 Correct 30 ms 11900 KB Output is correct
73 Correct 32 ms 11868 KB Output is correct
74 Correct 25 ms 11864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 14 ms 4952 KB Output is correct
20 Correct 8 ms 7328 KB Output is correct
21 Correct 9 ms 5724 KB Output is correct
22 Correct 10 ms 5060 KB Output is correct
23 Correct 8 ms 4956 KB Output is correct
24 Correct 11 ms 9072 KB Output is correct
25 Correct 12 ms 9072 KB Output is correct
26 Correct 10 ms 5128 KB Output is correct
27 Correct 10 ms 5044 KB Output is correct
28 Correct 8 ms 4956 KB Output is correct
29 Correct 23 ms 11712 KB Output is correct
30 Correct 11 ms 7004 KB Output is correct
31 Correct 23 ms 13656 KB Output is correct
32 Correct 30 ms 12120 KB Output is correct
33 Correct 22 ms 11868 KB Output is correct
34 Correct 27 ms 22144 KB Output is correct
35 Correct 27 ms 22288 KB Output is correct
36 Correct 28 ms 11868 KB Output is correct
37 Correct 30 ms 11892 KB Output is correct
38 Correct 25 ms 11864 KB Output is correct
39 Correct 308 ms 115028 KB Output is correct
40 Correct 26 ms 13916 KB Output is correct
41 Correct 35 ms 27320 KB Output is correct
42 Correct 39 ms 16728 KB Output is correct
43 Correct 39 ms 27260 KB Output is correct
44 Correct 115 ms 64880 KB Output is correct
45 Correct 127 ms 71948 KB Output is correct
46 Correct 280 ms 132868 KB Output is correct
47 Correct 343 ms 115104 KB Output is correct
48 Correct 358 ms 115024 KB Output is correct
49 Correct 313 ms 219044 KB Output is correct
50 Correct 310 ms 218976 KB Output is correct
51 Correct 411 ms 115548 KB Output is correct
52 Correct 397 ms 115480 KB Output is correct
53 Correct 365 ms 114832 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 548 KB Output is correct
71 Correct 0 ms 440 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 344 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 1 ms 344 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 436 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 436 KB Output is correct
95 Correct 1 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 1 ms 420 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 7 ms 3388 KB Output is correct
111 Correct 10 ms 4960 KB Output is correct
112 Correct 12 ms 5556 KB Output is correct
113 Correct 12 ms 5556 KB Output is correct
114 Correct 9 ms 5468 KB Output is correct
115 Correct 8 ms 5468 KB Output is correct
116 Correct 9 ms 4956 KB Output is correct
117 Correct 11 ms 4952 KB Output is correct
118 Correct 13 ms 4956 KB Output is correct
119 Correct 25 ms 11120 KB Output is correct
120 Correct 22 ms 13660 KB Output is correct
121 Correct 30 ms 13736 KB Output is correct
122 Correct 23 ms 13192 KB Output is correct
123 Correct 21 ms 13148 KB Output is correct
124 Correct 133 ms 38784 KB Output is correct
125 Correct 404 ms 112940 KB Output is correct
126 Correct 299 ms 132872 KB Output is correct
127 Correct 338 ms 133120 KB Output is correct
128 Correct 320 ms 127220 KB Output is correct
129 Correct 312 ms 127108 KB Output is correct
130 Correct 448 ms 132644 KB Output is correct
131 Correct 422 ms 132996 KB Output is correct
132 Correct 11 ms 4952 KB Output is correct
133 Correct 1 ms 604 KB Output is correct
134 Correct 1 ms 936 KB Output is correct
135 Correct 6 ms 3160 KB Output is correct
136 Correct 9 ms 7076 KB Output is correct
137 Correct 12 ms 5144 KB Output is correct
138 Correct 11 ms 5724 KB Output is correct
139 Correct 10 ms 5040 KB Output is correct
140 Correct 8 ms 4956 KB Output is correct
141 Correct 13 ms 5796 KB Output is correct
142 Correct 8 ms 5532 KB Output is correct
143 Correct 9 ms 5468 KB Output is correct
144 Correct 11 ms 9056 KB Output is correct
145 Correct 12 ms 9068 KB Output is correct
146 Correct 11 ms 7004 KB Output is correct
147 Correct 11 ms 5212 KB Output is correct
148 Correct 10 ms 4956 KB Output is correct
149 Correct 9 ms 4956 KB Output is correct
150 Correct 8 ms 5084 KB Output is correct
151 Correct 11 ms 4956 KB Output is correct
152 Correct 14 ms 4956 KB Output is correct
153 Correct 9 ms 4956 KB Output is correct
154 Correct 27 ms 11868 KB Output is correct
155 Correct 11 ms 7004 KB Output is correct
156 Correct 29 ms 10996 KB Output is correct
157 Correct 31 ms 11356 KB Output is correct
158 Correct 22 ms 13656 KB Output is correct
159 Correct 36 ms 11936 KB Output is correct
160 Correct 26 ms 11908 KB Output is correct
161 Correct 36 ms 13660 KB Output is correct
162 Correct 23 ms 13144 KB Output is correct
163 Correct 26 ms 13144 KB Output is correct
164 Correct 30 ms 22272 KB Output is correct
165 Correct 37 ms 22276 KB Output is correct
166 Correct 26 ms 16988 KB Output is correct
167 Correct 22 ms 12124 KB Output is correct
168 Correct 29 ms 12124 KB Output is correct
169 Correct 25 ms 12084 KB Output is correct
170 Correct 23 ms 12024 KB Output is correct
171 Correct 30 ms 11900 KB Output is correct
172 Correct 32 ms 11868 KB Output is correct
173 Correct 25 ms 11864 KB Output is correct
174 Correct 40 ms 16472 KB Output is correct
175 Correct 60 ms 26208 KB Output is correct
176 Correct 137 ms 75628 KB Output is correct
177 Correct 207 ms 79316 KB Output is correct
178 Correct 277 ms 101500 KB Output is correct
179 Correct 245 ms 115984 KB Output is correct
180 Correct 305 ms 116004 KB Output is correct
181 Correct 320 ms 115532 KB Output is correct
182 Correct 326 ms 115472 KB Output is correct
183 Correct 361 ms 117428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 14 ms 4952 KB Output is correct
20 Correct 8 ms 7328 KB Output is correct
21 Correct 9 ms 5724 KB Output is correct
22 Correct 10 ms 5060 KB Output is correct
23 Correct 8 ms 4956 KB Output is correct
24 Correct 11 ms 9072 KB Output is correct
25 Correct 12 ms 9072 KB Output is correct
26 Correct 10 ms 5128 KB Output is correct
27 Correct 10 ms 5044 KB Output is correct
28 Correct 8 ms 4956 KB Output is correct
29 Correct 23 ms 11712 KB Output is correct
30 Correct 11 ms 7004 KB Output is correct
31 Correct 23 ms 13656 KB Output is correct
32 Correct 30 ms 12120 KB Output is correct
33 Correct 22 ms 11868 KB Output is correct
34 Correct 27 ms 22144 KB Output is correct
35 Correct 27 ms 22288 KB Output is correct
36 Correct 28 ms 11868 KB Output is correct
37 Correct 30 ms 11892 KB Output is correct
38 Correct 25 ms 11864 KB Output is correct
39 Correct 308 ms 115028 KB Output is correct
40 Correct 26 ms 13916 KB Output is correct
41 Correct 35 ms 27320 KB Output is correct
42 Correct 39 ms 16728 KB Output is correct
43 Correct 39 ms 27260 KB Output is correct
44 Correct 115 ms 64880 KB Output is correct
45 Correct 127 ms 71948 KB Output is correct
46 Correct 280 ms 132868 KB Output is correct
47 Correct 343 ms 115104 KB Output is correct
48 Correct 358 ms 115024 KB Output is correct
49 Correct 313 ms 219044 KB Output is correct
50 Correct 310 ms 218976 KB Output is correct
51 Correct 411 ms 115548 KB Output is correct
52 Correct 397 ms 115480 KB Output is correct
53 Correct 365 ms 114832 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 548 KB Output is correct
71 Correct 0 ms 440 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 344 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 1 ms 344 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 436 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 436 KB Output is correct
95 Correct 1 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 1 ms 420 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 7 ms 3388 KB Output is correct
111 Correct 10 ms 4960 KB Output is correct
112 Correct 12 ms 5556 KB Output is correct
113 Correct 12 ms 5556 KB Output is correct
114 Correct 9 ms 5468 KB Output is correct
115 Correct 8 ms 5468 KB Output is correct
116 Correct 9 ms 4956 KB Output is correct
117 Correct 11 ms 4952 KB Output is correct
118 Correct 13 ms 4956 KB Output is correct
119 Correct 25 ms 11120 KB Output is correct
120 Correct 22 ms 13660 KB Output is correct
121 Correct 30 ms 13736 KB Output is correct
122 Correct 23 ms 13192 KB Output is correct
123 Correct 21 ms 13148 KB Output is correct
124 Correct 133 ms 38784 KB Output is correct
125 Correct 404 ms 112940 KB Output is correct
126 Correct 299 ms 132872 KB Output is correct
127 Correct 338 ms 133120 KB Output is correct
128 Correct 320 ms 127220 KB Output is correct
129 Correct 312 ms 127108 KB Output is correct
130 Correct 448 ms 132644 KB Output is correct
131 Correct 422 ms 132996 KB Output is correct
132 Correct 11 ms 4952 KB Output is correct
133 Correct 1 ms 604 KB Output is correct
134 Correct 1 ms 936 KB Output is correct
135 Correct 6 ms 3160 KB Output is correct
136 Correct 9 ms 7076 KB Output is correct
137 Correct 12 ms 5144 KB Output is correct
138 Correct 11 ms 5724 KB Output is correct
139 Correct 10 ms 5040 KB Output is correct
140 Correct 8 ms 4956 KB Output is correct
141 Correct 13 ms 5796 KB Output is correct
142 Correct 8 ms 5532 KB Output is correct
143 Correct 9 ms 5468 KB Output is correct
144 Correct 11 ms 9056 KB Output is correct
145 Correct 12 ms 9068 KB Output is correct
146 Correct 11 ms 7004 KB Output is correct
147 Correct 11 ms 5212 KB Output is correct
148 Correct 10 ms 4956 KB Output is correct
149 Correct 9 ms 4956 KB Output is correct
150 Correct 8 ms 5084 KB Output is correct
151 Correct 11 ms 4956 KB Output is correct
152 Correct 14 ms 4956 KB Output is correct
153 Correct 9 ms 4956 KB Output is correct
154 Correct 27 ms 11868 KB Output is correct
155 Correct 11 ms 7004 KB Output is correct
156 Correct 29 ms 10996 KB Output is correct
157 Correct 31 ms 11356 KB Output is correct
158 Correct 22 ms 13656 KB Output is correct
159 Correct 36 ms 11936 KB Output is correct
160 Correct 26 ms 11908 KB Output is correct
161 Correct 36 ms 13660 KB Output is correct
162 Correct 23 ms 13144 KB Output is correct
163 Correct 26 ms 13144 KB Output is correct
164 Correct 30 ms 22272 KB Output is correct
165 Correct 37 ms 22276 KB Output is correct
166 Correct 26 ms 16988 KB Output is correct
167 Correct 22 ms 12124 KB Output is correct
168 Correct 29 ms 12124 KB Output is correct
169 Correct 25 ms 12084 KB Output is correct
170 Correct 23 ms 12024 KB Output is correct
171 Correct 30 ms 11900 KB Output is correct
172 Correct 32 ms 11868 KB Output is correct
173 Correct 25 ms 11864 KB Output is correct
174 Correct 40 ms 16472 KB Output is correct
175 Correct 60 ms 26208 KB Output is correct
176 Correct 137 ms 75628 KB Output is correct
177 Correct 207 ms 79316 KB Output is correct
178 Correct 277 ms 101500 KB Output is correct
179 Correct 245 ms 115984 KB Output is correct
180 Correct 305 ms 116004 KB Output is correct
181 Correct 320 ms 115532 KB Output is correct
182 Correct 326 ms 115472 KB Output is correct
183 Correct 361 ms 117428 KB Output is correct
184 Correct 745 ms 229684 KB Output is correct
185 Correct 317 ms 128144 KB Output is correct
186 Correct 548 ms 153692 KB Output is correct
187 Correct 521 ms 164632 KB Output is correct
188 Correct 562 ms 265312 KB Output is correct
189 Correct 840 ms 229784 KB Output is correct
190 Correct 658 ms 229540 KB Output is correct
191 Correct 757 ms 266272 KB Output is correct
192 Correct 657 ms 254312 KB Output is correct
193 Correct 715 ms 254000 KB Output is correct
194 Correct 634 ms 437616 KB Output is correct
195 Correct 592 ms 437620 KB Output is correct
196 Correct 592 ms 230972 KB Output is correct
197 Correct 529 ms 230584 KB Output is correct
198 Correct 549 ms 230180 KB Output is correct
199 Correct 531 ms 230736 KB Output is correct
200 Correct 849 ms 230652 KB Output is correct
201 Correct 829 ms 230228 KB Output is correct
202 Correct 758 ms 229456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 14 ms 4952 KB Output is correct
20 Correct 8 ms 7328 KB Output is correct
21 Correct 9 ms 5724 KB Output is correct
22 Correct 10 ms 5060 KB Output is correct
23 Correct 8 ms 4956 KB Output is correct
24 Correct 11 ms 9072 KB Output is correct
25 Correct 12 ms 9072 KB Output is correct
26 Correct 10 ms 5128 KB Output is correct
27 Correct 10 ms 5044 KB Output is correct
28 Correct 8 ms 4956 KB Output is correct
29 Correct 23 ms 11712 KB Output is correct
30 Correct 11 ms 7004 KB Output is correct
31 Correct 23 ms 13656 KB Output is correct
32 Correct 30 ms 12120 KB Output is correct
33 Correct 22 ms 11868 KB Output is correct
34 Correct 27 ms 22144 KB Output is correct
35 Correct 27 ms 22288 KB Output is correct
36 Correct 28 ms 11868 KB Output is correct
37 Correct 30 ms 11892 KB Output is correct
38 Correct 25 ms 11864 KB Output is correct
39 Correct 308 ms 115028 KB Output is correct
40 Correct 26 ms 13916 KB Output is correct
41 Correct 35 ms 27320 KB Output is correct
42 Correct 39 ms 16728 KB Output is correct
43 Correct 39 ms 27260 KB Output is correct
44 Correct 115 ms 64880 KB Output is correct
45 Correct 127 ms 71948 KB Output is correct
46 Correct 280 ms 132868 KB Output is correct
47 Correct 343 ms 115104 KB Output is correct
48 Correct 358 ms 115024 KB Output is correct
49 Correct 313 ms 219044 KB Output is correct
50 Correct 310 ms 218976 KB Output is correct
51 Correct 411 ms 115548 KB Output is correct
52 Correct 397 ms 115480 KB Output is correct
53 Correct 365 ms 114832 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 548 KB Output is correct
71 Correct 0 ms 440 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 344 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 1 ms 344 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 436 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 436 KB Output is correct
95 Correct 1 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 1 ms 420 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 7 ms 3388 KB Output is correct
111 Correct 10 ms 4960 KB Output is correct
112 Correct 12 ms 5556 KB Output is correct
113 Correct 12 ms 5556 KB Output is correct
114 Correct 9 ms 5468 KB Output is correct
115 Correct 8 ms 5468 KB Output is correct
116 Correct 9 ms 4956 KB Output is correct
117 Correct 11 ms 4952 KB Output is correct
118 Correct 13 ms 4956 KB Output is correct
119 Correct 25 ms 11120 KB Output is correct
120 Correct 22 ms 13660 KB Output is correct
121 Correct 30 ms 13736 KB Output is correct
122 Correct 23 ms 13192 KB Output is correct
123 Correct 21 ms 13148 KB Output is correct
124 Correct 133 ms 38784 KB Output is correct
125 Correct 404 ms 112940 KB Output is correct
126 Correct 299 ms 132872 KB Output is correct
127 Correct 338 ms 133120 KB Output is correct
128 Correct 320 ms 127220 KB Output is correct
129 Correct 312 ms 127108 KB Output is correct
130 Correct 448 ms 132644 KB Output is correct
131 Correct 422 ms 132996 KB Output is correct
132 Correct 11 ms 4952 KB Output is correct
133 Correct 1 ms 604 KB Output is correct
134 Correct 1 ms 936 KB Output is correct
135 Correct 6 ms 3160 KB Output is correct
136 Correct 9 ms 7076 KB Output is correct
137 Correct 12 ms 5144 KB Output is correct
138 Correct 11 ms 5724 KB Output is correct
139 Correct 10 ms 5040 KB Output is correct
140 Correct 8 ms 4956 KB Output is correct
141 Correct 13 ms 5796 KB Output is correct
142 Correct 8 ms 5532 KB Output is correct
143 Correct 9 ms 5468 KB Output is correct
144 Correct 11 ms 9056 KB Output is correct
145 Correct 12 ms 9068 KB Output is correct
146 Correct 11 ms 7004 KB Output is correct
147 Correct 11 ms 5212 KB Output is correct
148 Correct 10 ms 4956 KB Output is correct
149 Correct 9 ms 4956 KB Output is correct
150 Correct 8 ms 5084 KB Output is correct
151 Correct 11 ms 4956 KB Output is correct
152 Correct 14 ms 4956 KB Output is correct
153 Correct 9 ms 4956 KB Output is correct
154 Correct 27 ms 11868 KB Output is correct
155 Correct 11 ms 7004 KB Output is correct
156 Correct 29 ms 10996 KB Output is correct
157 Correct 31 ms 11356 KB Output is correct
158 Correct 22 ms 13656 KB Output is correct
159 Correct 36 ms 11936 KB Output is correct
160 Correct 26 ms 11908 KB Output is correct
161 Correct 36 ms 13660 KB Output is correct
162 Correct 23 ms 13144 KB Output is correct
163 Correct 26 ms 13144 KB Output is correct
164 Correct 30 ms 22272 KB Output is correct
165 Correct 37 ms 22276 KB Output is correct
166 Correct 26 ms 16988 KB Output is correct
167 Correct 22 ms 12124 KB Output is correct
168 Correct 29 ms 12124 KB Output is correct
169 Correct 25 ms 12084 KB Output is correct
170 Correct 23 ms 12024 KB Output is correct
171 Correct 30 ms 11900 KB Output is correct
172 Correct 32 ms 11868 KB Output is correct
173 Correct 25 ms 11864 KB Output is correct
174 Correct 40 ms 16472 KB Output is correct
175 Correct 60 ms 26208 KB Output is correct
176 Correct 137 ms 75628 KB Output is correct
177 Correct 207 ms 79316 KB Output is correct
178 Correct 277 ms 101500 KB Output is correct
179 Correct 245 ms 115984 KB Output is correct
180 Correct 305 ms 116004 KB Output is correct
181 Correct 320 ms 115532 KB Output is correct
182 Correct 326 ms 115472 KB Output is correct
183 Correct 361 ms 117428 KB Output is correct
184 Correct 745 ms 229684 KB Output is correct
185 Correct 317 ms 128144 KB Output is correct
186 Correct 548 ms 153692 KB Output is correct
187 Correct 521 ms 164632 KB Output is correct
188 Correct 562 ms 265312 KB Output is correct
189 Correct 840 ms 229784 KB Output is correct
190 Correct 658 ms 229540 KB Output is correct
191 Correct 757 ms 266272 KB Output is correct
192 Correct 657 ms 254312 KB Output is correct
193 Correct 715 ms 254000 KB Output is correct
194 Correct 634 ms 437616 KB Output is correct
195 Correct 592 ms 437620 KB Output is correct
196 Correct 592 ms 230972 KB Output is correct
197 Correct 529 ms 230584 KB Output is correct
198 Correct 549 ms 230180 KB Output is correct
199 Correct 531 ms 230736 KB Output is correct
200 Correct 849 ms 230652 KB Output is correct
201 Correct 829 ms 230228 KB Output is correct
202 Correct 758 ms 229456 KB Output is correct
203 Correct 1565 ms 458328 KB Output is correct
204 Correct 757 ms 240944 KB Output is correct
205 Correct 988 ms 280912 KB Output is correct
206 Correct 1124 ms 462380 KB Output is correct
207 Correct 1244 ms 530200 KB Output is correct
208 Correct 1819 ms 458716 KB Output is correct
209 Correct 1443 ms 458584 KB Output is correct
210 Correct 1491 ms 531776 KB Output is correct
211 Correct 1097 ms 507628 KB Output is correct
212 Correct 1484 ms 507488 KB Output is correct
213 Correct 1246 ms 875156 KB Output is correct
214 Correct 1229 ms 875092 KB Output is correct
215 Correct 1217 ms 461080 KB Output is correct
216 Correct 1242 ms 460308 KB Output is correct
217 Correct 1195 ms 460096 KB Output is correct
218 Correct 1560 ms 460580 KB Output is correct
219 Correct 1927 ms 481688 KB Output is correct
220 Execution timed out 2079 ms 503120 KB Time limit exceeded
221 Halted 0 ms 0 KB -