Submission #729432

# Submission time Handle Problem Language Result Execution time Memory
729432 2023-04-24T07:01:03 Z MohammadAghil Maze (JOI23_ho_t3) C++17
100 / 100
909 ms 164920 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("avx2")
#define rep(i,l,r) for(int i = (l); i < (r); i++)
#define per(i,r,l) for(int i = (r); i >= (l); i--)
#define all(x) begin(x), end(x)
#define sz(x) (int)size(x)
#define pb push_back
#define ff first
#define ss second
typedef long long ll;
typedef pair<int, int> pp;

void dbg(){
     cerr << endl;
}
template<typename H, typename... T> void dbg(H h, T... t){
     cerr << h << ", ";
     dbg(t...);
}

void IOS(){
     cin.tie(0) -> sync_with_stdio(0);
     #ifndef ONLINE_JUDGE
          // freopen("inp.txt", "r", stdin);
          // freopen("out.txt", "w", stdout);
          #define er(...) cerr << __LINE__ << " <" << #__VA_ARGS__ << ">: ", dbg(__VA_ARGS__)
     #else
          #define er(...) 0
     #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9 + 7, maxn = 1e5 + 5, maxk = 31, lg = 18, inf = ll(1e18) + 5;

int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
int dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1}, dx2[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int r, c;

int main(){ IOS();
     int n; cin >> r >> c >> n;
     pp st, en; cin >> st.ff >> st.ss >> en.ff >> en.ss;
     st = {st.ff-1, st.ss-1}, en = {en.ff-1, en.ss-1};
     vector<vector<bool>> is(r, vector<bool>(c));
     vector<vector<int>> dist(r, vector<int>(c, -1));
     vector<vector<int>> dist2(r, vector<int>(c, -1));
     rep(i,0,r){
          rep(j,0,c){
               char x; cin >> x;
               is[i][j] = x == '.';
          }
     }
     vector<pp> cand{st};
     dist[st.ff][st.ss] = 0;
     while(sz(cand)){
          int D = dist[cand.back().ff][cand.back().ss];
          vector<pp> q;
          while(sz(cand)){
               q.pb(cand.back());
               auto[a, b] = cand.back(); cand.pop_back();
               dist2[a][b] = 0;
               rep(d,0,4){
                    int x = a + dx[d], y = b + dy[d];
                    if(x < 0 || x >= r || y < 0 || y >= c || !is[x][y] || dist[x][y] + 1) continue; 
                    dist[x][y] = D;
                    cand.pb({x, y});
               }
          }
          int l = 0;
          while(l < sz(q)){
               auto[a, b] = q[l++];
               if(dist[a][b] == -1){
                    cand.pb({a, b});
                    dist[a][b] = D + 1;
               }
               if(dist2[a][b] < n - 1){
                    rep(d,0,8){
                         int x = a + dx2[d], y = b + dy2[d];
                         if(x < 0 || x >= r || y < 0 || y >= c || dist[x][y] + 1 || dist2[x][y] + 1) continue;
                         dist2[x][y] = dist2[a][b] + 1;
                         q.pb({x, y});
                    }    
               } else if(dist2[a][b] == n-1){
                    rep(d,0,4){
                         int x = a + dx[d], y = b + dy[d];
                         if(x < 0 || x >= r || y < 0 || y >= c || dist[x][y] + 1 || dist2[x][y] + 1) continue;
                         dist2[x][y] = dist2[a][b] + 1;
                         q.pb({x, y});
                    }
               }
          }
     }
     cout << dist[en.ff][en.ss] << '\n';
     return 0;
}
# 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 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 6 ms 848 KB Output is correct
20 Correct 5 ms 944 KB Output is correct
21 Correct 5 ms 1756 KB Output is correct
22 Correct 9 ms 852 KB Output is correct
23 Correct 5 ms 884 KB Output is correct
24 Correct 4 ms 1072 KB Output is correct
25 Correct 7 ms 1000 KB Output is correct
26 Correct 10 ms 1172 KB Output is correct
27 Correct 9 ms 980 KB Output is correct
28 Correct 7 ms 852 KB Output is correct
29 Correct 14 ms 1692 KB Output is correct
30 Correct 10 ms 980 KB Output is correct
31 Correct 11 ms 4420 KB Output is correct
32 Correct 17 ms 1828 KB Output is correct
33 Correct 11 ms 1752 KB Output is correct
34 Correct 10 ms 2184 KB Output is correct
35 Correct 16 ms 2260 KB Output is correct
36 Correct 20 ms 2192 KB Output is correct
37 Correct 20 ms 1992 KB Output is correct
38 Correct 12 ms 1748 KB Output is correct
39 Correct 146 ms 13480 KB Output is correct
40 Correct 20 ms 1860 KB Output is correct
41 Correct 14 ms 2688 KB Output is correct
42 Correct 25 ms 2196 KB Output is correct
43 Correct 28 ms 2972 KB Output is correct
44 Correct 75 ms 7328 KB Output is correct
45 Correct 90 ms 8020 KB Output is correct
46 Correct 113 ms 36164 KB Output is correct
47 Correct 174 ms 13952 KB Output is correct
48 Correct 148 ms 13852 KB Output is correct
49 Correct 87 ms 19476 KB Output is correct
50 Correct 139 ms 19548 KB Output is correct
51 Correct 191 ms 15708 KB Output is correct
52 Correct 189 ms 14200 KB Output is correct
53 Correct 132 ms 14132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 7 ms 704 KB Output is correct
26 Correct 7 ms 1488 KB Output is correct
27 Correct 6 ms 1872 KB Output is correct
28 Correct 5 ms 1744 KB Output is correct
29 Correct 8 ms 2292 KB Output is correct
30 Correct 7 ms 2344 KB Output is correct
31 Correct 8 ms 1144 KB Output is correct
32 Correct 8 ms 1172 KB Output is correct
33 Correct 7 ms 980 KB Output is correct
34 Correct 17 ms 2856 KB Output is correct
35 Correct 12 ms 4432 KB Output is correct
36 Correct 14 ms 4460 KB Output is correct
37 Correct 24 ms 6076 KB Output is correct
38 Correct 19 ms 6060 KB Output is correct
39 Correct 57 ms 9564 KB Output is correct
40 Correct 170 ms 30956 KB Output is correct
41 Correct 107 ms 36340 KB Output is correct
42 Correct 130 ms 36212 KB Output is correct
43 Correct 219 ms 53772 KB Output is correct
44 Correct 211 ms 53656 KB Output is correct
45 Correct 224 ms 38028 KB Output is correct
46 Correct 227 ms 38284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 5 ms 852 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 6 ms 596 KB Output is correct
37 Correct 5 ms 924 KB Output is correct
38 Correct 7 ms 1448 KB Output is correct
39 Correct 6 ms 1744 KB Output is correct
40 Correct 8 ms 848 KB Output is correct
41 Correct 5 ms 900 KB Output is correct
42 Correct 5 ms 1736 KB Output is correct
43 Correct 9 ms 2292 KB Output is correct
44 Correct 6 ms 2288 KB Output is correct
45 Correct 4 ms 1000 KB Output is correct
46 Correct 6 ms 1000 KB Output is correct
47 Correct 8 ms 944 KB Output is correct
48 Correct 9 ms 852 KB Output is correct
49 Correct 9 ms 820 KB Output is correct
50 Correct 8 ms 852 KB Output is correct
51 Correct 8 ms 1144 KB Output is correct
52 Correct 7 ms 1172 KB Output is correct
53 Correct 8 ms 1016 KB Output is correct
54 Correct 5 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 5 ms 852 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 6 ms 596 KB Output is correct
37 Correct 5 ms 924 KB Output is correct
38 Correct 7 ms 1448 KB Output is correct
39 Correct 6 ms 1744 KB Output is correct
40 Correct 8 ms 848 KB Output is correct
41 Correct 5 ms 900 KB Output is correct
42 Correct 5 ms 1736 KB Output is correct
43 Correct 9 ms 2292 KB Output is correct
44 Correct 6 ms 2288 KB Output is correct
45 Correct 4 ms 1000 KB Output is correct
46 Correct 6 ms 1000 KB Output is correct
47 Correct 8 ms 944 KB Output is correct
48 Correct 9 ms 852 KB Output is correct
49 Correct 9 ms 820 KB Output is correct
50 Correct 8 ms 852 KB Output is correct
51 Correct 8 ms 1144 KB Output is correct
52 Correct 7 ms 1172 KB Output is correct
53 Correct 8 ms 1016 KB Output is correct
54 Correct 5 ms 852 KB Output is correct
55 Correct 13 ms 1680 KB Output is correct
56 Correct 8 ms 980 KB Output is correct
57 Correct 16 ms 2892 KB Output is correct
58 Correct 19 ms 1492 KB Output is correct
59 Correct 11 ms 4464 KB Output is correct
60 Correct 16 ms 1748 KB Output is correct
61 Correct 12 ms 1748 KB Output is correct
62 Correct 11 ms 4428 KB Output is correct
63 Correct 21 ms 6120 KB Output is correct
64 Correct 17 ms 6100 KB Output is correct
65 Correct 8 ms 2152 KB Output is correct
66 Correct 14 ms 2272 KB Output is correct
67 Correct 17 ms 1964 KB Output is correct
68 Correct 19 ms 1692 KB Output is correct
69 Correct 19 ms 1748 KB Output is correct
70 Correct 19 ms 1960 KB Output is correct
71 Correct 18 ms 2284 KB Output is correct
72 Correct 18 ms 2196 KB Output is correct
73 Correct 18 ms 2004 KB Output is correct
74 Correct 11 ms 1748 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 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 6 ms 848 KB Output is correct
20 Correct 5 ms 944 KB Output is correct
21 Correct 5 ms 1756 KB Output is correct
22 Correct 9 ms 852 KB Output is correct
23 Correct 5 ms 884 KB Output is correct
24 Correct 4 ms 1072 KB Output is correct
25 Correct 7 ms 1000 KB Output is correct
26 Correct 10 ms 1172 KB Output is correct
27 Correct 9 ms 980 KB Output is correct
28 Correct 7 ms 852 KB Output is correct
29 Correct 14 ms 1692 KB Output is correct
30 Correct 10 ms 980 KB Output is correct
31 Correct 11 ms 4420 KB Output is correct
32 Correct 17 ms 1828 KB Output is correct
33 Correct 11 ms 1752 KB Output is correct
34 Correct 10 ms 2184 KB Output is correct
35 Correct 16 ms 2260 KB Output is correct
36 Correct 20 ms 2192 KB Output is correct
37 Correct 20 ms 1992 KB Output is correct
38 Correct 12 ms 1748 KB Output is correct
39 Correct 146 ms 13480 KB Output is correct
40 Correct 20 ms 1860 KB Output is correct
41 Correct 14 ms 2688 KB Output is correct
42 Correct 25 ms 2196 KB Output is correct
43 Correct 28 ms 2972 KB Output is correct
44 Correct 75 ms 7328 KB Output is correct
45 Correct 90 ms 8020 KB Output is correct
46 Correct 113 ms 36164 KB Output is correct
47 Correct 174 ms 13952 KB Output is correct
48 Correct 148 ms 13852 KB Output is correct
49 Correct 87 ms 19476 KB Output is correct
50 Correct 139 ms 19548 KB Output is correct
51 Correct 191 ms 15708 KB Output is correct
52 Correct 189 ms 14200 KB Output is correct
53 Correct 132 ms 14132 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 1 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 1 ms 212 KB Output is correct
92 Correct 1 ms 340 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 1 ms 212 KB Output is correct
100 Correct 1 ms 212 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 384 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 7 ms 704 KB Output is correct
111 Correct 7 ms 1488 KB Output is correct
112 Correct 6 ms 1872 KB Output is correct
113 Correct 5 ms 1744 KB Output is correct
114 Correct 8 ms 2292 KB Output is correct
115 Correct 7 ms 2344 KB Output is correct
116 Correct 8 ms 1144 KB Output is correct
117 Correct 8 ms 1172 KB Output is correct
118 Correct 7 ms 980 KB Output is correct
119 Correct 17 ms 2856 KB Output is correct
120 Correct 12 ms 4432 KB Output is correct
121 Correct 14 ms 4460 KB Output is correct
122 Correct 24 ms 6076 KB Output is correct
123 Correct 19 ms 6060 KB Output is correct
124 Correct 57 ms 9564 KB Output is correct
125 Correct 170 ms 30956 KB Output is correct
126 Correct 107 ms 36340 KB Output is correct
127 Correct 130 ms 36212 KB Output is correct
128 Correct 219 ms 53772 KB Output is correct
129 Correct 211 ms 53656 KB Output is correct
130 Correct 224 ms 38028 KB Output is correct
131 Correct 227 ms 38284 KB Output is correct
132 Correct 5 ms 852 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 6 ms 596 KB Output is correct
136 Correct 5 ms 924 KB Output is correct
137 Correct 7 ms 1448 KB Output is correct
138 Correct 6 ms 1744 KB Output is correct
139 Correct 8 ms 848 KB Output is correct
140 Correct 5 ms 900 KB Output is correct
141 Correct 5 ms 1736 KB Output is correct
142 Correct 9 ms 2292 KB Output is correct
143 Correct 6 ms 2288 KB Output is correct
144 Correct 4 ms 1000 KB Output is correct
145 Correct 6 ms 1000 KB Output is correct
146 Correct 8 ms 944 KB Output is correct
147 Correct 9 ms 852 KB Output is correct
148 Correct 9 ms 820 KB Output is correct
149 Correct 8 ms 852 KB Output is correct
150 Correct 8 ms 1144 KB Output is correct
151 Correct 7 ms 1172 KB Output is correct
152 Correct 8 ms 1016 KB Output is correct
153 Correct 5 ms 852 KB Output is correct
154 Correct 13 ms 1680 KB Output is correct
155 Correct 8 ms 980 KB Output is correct
156 Correct 16 ms 2892 KB Output is correct
157 Correct 19 ms 1492 KB Output is correct
158 Correct 11 ms 4464 KB Output is correct
159 Correct 16 ms 1748 KB Output is correct
160 Correct 12 ms 1748 KB Output is correct
161 Correct 11 ms 4428 KB Output is correct
162 Correct 21 ms 6120 KB Output is correct
163 Correct 17 ms 6100 KB Output is correct
164 Correct 8 ms 2152 KB Output is correct
165 Correct 14 ms 2272 KB Output is correct
166 Correct 17 ms 1964 KB Output is correct
167 Correct 19 ms 1692 KB Output is correct
168 Correct 19 ms 1748 KB Output is correct
169 Correct 19 ms 1960 KB Output is correct
170 Correct 18 ms 2284 KB Output is correct
171 Correct 18 ms 2196 KB Output is correct
172 Correct 18 ms 2004 KB Output is correct
173 Correct 11 ms 1748 KB Output is correct
174 Correct 28 ms 2004 KB Output is correct
175 Correct 36 ms 3412 KB Output is correct
176 Correct 92 ms 8048 KB Output is correct
177 Correct 123 ms 9452 KB Output is correct
178 Correct 174 ms 12092 KB Output is correct
179 Correct 170 ms 14028 KB Output is correct
180 Correct 176 ms 14208 KB Output is correct
181 Correct 193 ms 14900 KB Output is correct
182 Correct 197 ms 17480 KB Output is correct
183 Correct 194 ms 18076 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 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 6 ms 848 KB Output is correct
20 Correct 5 ms 944 KB Output is correct
21 Correct 5 ms 1756 KB Output is correct
22 Correct 9 ms 852 KB Output is correct
23 Correct 5 ms 884 KB Output is correct
24 Correct 4 ms 1072 KB Output is correct
25 Correct 7 ms 1000 KB Output is correct
26 Correct 10 ms 1172 KB Output is correct
27 Correct 9 ms 980 KB Output is correct
28 Correct 7 ms 852 KB Output is correct
29 Correct 14 ms 1692 KB Output is correct
30 Correct 10 ms 980 KB Output is correct
31 Correct 11 ms 4420 KB Output is correct
32 Correct 17 ms 1828 KB Output is correct
33 Correct 11 ms 1752 KB Output is correct
34 Correct 10 ms 2184 KB Output is correct
35 Correct 16 ms 2260 KB Output is correct
36 Correct 20 ms 2192 KB Output is correct
37 Correct 20 ms 1992 KB Output is correct
38 Correct 12 ms 1748 KB Output is correct
39 Correct 146 ms 13480 KB Output is correct
40 Correct 20 ms 1860 KB Output is correct
41 Correct 14 ms 2688 KB Output is correct
42 Correct 25 ms 2196 KB Output is correct
43 Correct 28 ms 2972 KB Output is correct
44 Correct 75 ms 7328 KB Output is correct
45 Correct 90 ms 8020 KB Output is correct
46 Correct 113 ms 36164 KB Output is correct
47 Correct 174 ms 13952 KB Output is correct
48 Correct 148 ms 13852 KB Output is correct
49 Correct 87 ms 19476 KB Output is correct
50 Correct 139 ms 19548 KB Output is correct
51 Correct 191 ms 15708 KB Output is correct
52 Correct 189 ms 14200 KB Output is correct
53 Correct 132 ms 14132 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 1 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 1 ms 212 KB Output is correct
92 Correct 1 ms 340 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 1 ms 212 KB Output is correct
100 Correct 1 ms 212 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 384 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 7 ms 704 KB Output is correct
111 Correct 7 ms 1488 KB Output is correct
112 Correct 6 ms 1872 KB Output is correct
113 Correct 5 ms 1744 KB Output is correct
114 Correct 8 ms 2292 KB Output is correct
115 Correct 7 ms 2344 KB Output is correct
116 Correct 8 ms 1144 KB Output is correct
117 Correct 8 ms 1172 KB Output is correct
118 Correct 7 ms 980 KB Output is correct
119 Correct 17 ms 2856 KB Output is correct
120 Correct 12 ms 4432 KB Output is correct
121 Correct 14 ms 4460 KB Output is correct
122 Correct 24 ms 6076 KB Output is correct
123 Correct 19 ms 6060 KB Output is correct
124 Correct 57 ms 9564 KB Output is correct
125 Correct 170 ms 30956 KB Output is correct
126 Correct 107 ms 36340 KB Output is correct
127 Correct 130 ms 36212 KB Output is correct
128 Correct 219 ms 53772 KB Output is correct
129 Correct 211 ms 53656 KB Output is correct
130 Correct 224 ms 38028 KB Output is correct
131 Correct 227 ms 38284 KB Output is correct
132 Correct 5 ms 852 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 6 ms 596 KB Output is correct
136 Correct 5 ms 924 KB Output is correct
137 Correct 7 ms 1448 KB Output is correct
138 Correct 6 ms 1744 KB Output is correct
139 Correct 8 ms 848 KB Output is correct
140 Correct 5 ms 900 KB Output is correct
141 Correct 5 ms 1736 KB Output is correct
142 Correct 9 ms 2292 KB Output is correct
143 Correct 6 ms 2288 KB Output is correct
144 Correct 4 ms 1000 KB Output is correct
145 Correct 6 ms 1000 KB Output is correct
146 Correct 8 ms 944 KB Output is correct
147 Correct 9 ms 852 KB Output is correct
148 Correct 9 ms 820 KB Output is correct
149 Correct 8 ms 852 KB Output is correct
150 Correct 8 ms 1144 KB Output is correct
151 Correct 7 ms 1172 KB Output is correct
152 Correct 8 ms 1016 KB Output is correct
153 Correct 5 ms 852 KB Output is correct
154 Correct 13 ms 1680 KB Output is correct
155 Correct 8 ms 980 KB Output is correct
156 Correct 16 ms 2892 KB Output is correct
157 Correct 19 ms 1492 KB Output is correct
158 Correct 11 ms 4464 KB Output is correct
159 Correct 16 ms 1748 KB Output is correct
160 Correct 12 ms 1748 KB Output is correct
161 Correct 11 ms 4428 KB Output is correct
162 Correct 21 ms 6120 KB Output is correct
163 Correct 17 ms 6100 KB Output is correct
164 Correct 8 ms 2152 KB Output is correct
165 Correct 14 ms 2272 KB Output is correct
166 Correct 17 ms 1964 KB Output is correct
167 Correct 19 ms 1692 KB Output is correct
168 Correct 19 ms 1748 KB Output is correct
169 Correct 19 ms 1960 KB Output is correct
170 Correct 18 ms 2284 KB Output is correct
171 Correct 18 ms 2196 KB Output is correct
172 Correct 18 ms 2004 KB Output is correct
173 Correct 11 ms 1748 KB Output is correct
174 Correct 28 ms 2004 KB Output is correct
175 Correct 36 ms 3412 KB Output is correct
176 Correct 92 ms 8048 KB Output is correct
177 Correct 123 ms 9452 KB Output is correct
178 Correct 174 ms 12092 KB Output is correct
179 Correct 170 ms 14028 KB Output is correct
180 Correct 176 ms 14208 KB Output is correct
181 Correct 193 ms 14900 KB Output is correct
182 Correct 197 ms 17480 KB Output is correct
183 Correct 194 ms 18076 KB Output is correct
184 Correct 277 ms 27456 KB Output is correct
185 Correct 187 ms 15112 KB Output is correct
186 Correct 225 ms 37940 KB Output is correct
187 Correct 249 ms 23712 KB Output is correct
188 Correct 210 ms 71764 KB Output is correct
189 Correct 332 ms 27956 KB Output is correct
190 Correct 241 ms 27216 KB Output is correct
191 Correct 230 ms 72064 KB Output is correct
192 Correct 457 ms 99916 KB Output is correct
193 Correct 352 ms 99892 KB Output is correct
194 Correct 159 ms 38324 KB Output is correct
195 Correct 265 ms 37760 KB Output is correct
196 Correct 375 ms 27368 KB Output is correct
197 Correct 352 ms 28068 KB Output is correct
198 Correct 352 ms 29220 KB Output is correct
199 Correct 382 ms 31576 KB Output is correct
200 Correct 316 ms 28140 KB Output is correct
201 Correct 328 ms 28444 KB Output is correct
202 Correct 268 ms 27644 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 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 6 ms 848 KB Output is correct
20 Correct 5 ms 944 KB Output is correct
21 Correct 5 ms 1756 KB Output is correct
22 Correct 9 ms 852 KB Output is correct
23 Correct 5 ms 884 KB Output is correct
24 Correct 4 ms 1072 KB Output is correct
25 Correct 7 ms 1000 KB Output is correct
26 Correct 10 ms 1172 KB Output is correct
27 Correct 9 ms 980 KB Output is correct
28 Correct 7 ms 852 KB Output is correct
29 Correct 14 ms 1692 KB Output is correct
30 Correct 10 ms 980 KB Output is correct
31 Correct 11 ms 4420 KB Output is correct
32 Correct 17 ms 1828 KB Output is correct
33 Correct 11 ms 1752 KB Output is correct
34 Correct 10 ms 2184 KB Output is correct
35 Correct 16 ms 2260 KB Output is correct
36 Correct 20 ms 2192 KB Output is correct
37 Correct 20 ms 1992 KB Output is correct
38 Correct 12 ms 1748 KB Output is correct
39 Correct 146 ms 13480 KB Output is correct
40 Correct 20 ms 1860 KB Output is correct
41 Correct 14 ms 2688 KB Output is correct
42 Correct 25 ms 2196 KB Output is correct
43 Correct 28 ms 2972 KB Output is correct
44 Correct 75 ms 7328 KB Output is correct
45 Correct 90 ms 8020 KB Output is correct
46 Correct 113 ms 36164 KB Output is correct
47 Correct 174 ms 13952 KB Output is correct
48 Correct 148 ms 13852 KB Output is correct
49 Correct 87 ms 19476 KB Output is correct
50 Correct 139 ms 19548 KB Output is correct
51 Correct 191 ms 15708 KB Output is correct
52 Correct 189 ms 14200 KB Output is correct
53 Correct 132 ms 14132 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 1 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 1 ms 212 KB Output is correct
92 Correct 1 ms 340 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 1 ms 212 KB Output is correct
100 Correct 1 ms 212 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 384 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 7 ms 704 KB Output is correct
111 Correct 7 ms 1488 KB Output is correct
112 Correct 6 ms 1872 KB Output is correct
113 Correct 5 ms 1744 KB Output is correct
114 Correct 8 ms 2292 KB Output is correct
115 Correct 7 ms 2344 KB Output is correct
116 Correct 8 ms 1144 KB Output is correct
117 Correct 8 ms 1172 KB Output is correct
118 Correct 7 ms 980 KB Output is correct
119 Correct 17 ms 2856 KB Output is correct
120 Correct 12 ms 4432 KB Output is correct
121 Correct 14 ms 4460 KB Output is correct
122 Correct 24 ms 6076 KB Output is correct
123 Correct 19 ms 6060 KB Output is correct
124 Correct 57 ms 9564 KB Output is correct
125 Correct 170 ms 30956 KB Output is correct
126 Correct 107 ms 36340 KB Output is correct
127 Correct 130 ms 36212 KB Output is correct
128 Correct 219 ms 53772 KB Output is correct
129 Correct 211 ms 53656 KB Output is correct
130 Correct 224 ms 38028 KB Output is correct
131 Correct 227 ms 38284 KB Output is correct
132 Correct 5 ms 852 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 6 ms 596 KB Output is correct
136 Correct 5 ms 924 KB Output is correct
137 Correct 7 ms 1448 KB Output is correct
138 Correct 6 ms 1744 KB Output is correct
139 Correct 8 ms 848 KB Output is correct
140 Correct 5 ms 900 KB Output is correct
141 Correct 5 ms 1736 KB Output is correct
142 Correct 9 ms 2292 KB Output is correct
143 Correct 6 ms 2288 KB Output is correct
144 Correct 4 ms 1000 KB Output is correct
145 Correct 6 ms 1000 KB Output is correct
146 Correct 8 ms 944 KB Output is correct
147 Correct 9 ms 852 KB Output is correct
148 Correct 9 ms 820 KB Output is correct
149 Correct 8 ms 852 KB Output is correct
150 Correct 8 ms 1144 KB Output is correct
151 Correct 7 ms 1172 KB Output is correct
152 Correct 8 ms 1016 KB Output is correct
153 Correct 5 ms 852 KB Output is correct
154 Correct 13 ms 1680 KB Output is correct
155 Correct 8 ms 980 KB Output is correct
156 Correct 16 ms 2892 KB Output is correct
157 Correct 19 ms 1492 KB Output is correct
158 Correct 11 ms 4464 KB Output is correct
159 Correct 16 ms 1748 KB Output is correct
160 Correct 12 ms 1748 KB Output is correct
161 Correct 11 ms 4428 KB Output is correct
162 Correct 21 ms 6120 KB Output is correct
163 Correct 17 ms 6100 KB Output is correct
164 Correct 8 ms 2152 KB Output is correct
165 Correct 14 ms 2272 KB Output is correct
166 Correct 17 ms 1964 KB Output is correct
167 Correct 19 ms 1692 KB Output is correct
168 Correct 19 ms 1748 KB Output is correct
169 Correct 19 ms 1960 KB Output is correct
170 Correct 18 ms 2284 KB Output is correct
171 Correct 18 ms 2196 KB Output is correct
172 Correct 18 ms 2004 KB Output is correct
173 Correct 11 ms 1748 KB Output is correct
174 Correct 28 ms 2004 KB Output is correct
175 Correct 36 ms 3412 KB Output is correct
176 Correct 92 ms 8048 KB Output is correct
177 Correct 123 ms 9452 KB Output is correct
178 Correct 174 ms 12092 KB Output is correct
179 Correct 170 ms 14028 KB Output is correct
180 Correct 176 ms 14208 KB Output is correct
181 Correct 193 ms 14900 KB Output is correct
182 Correct 197 ms 17480 KB Output is correct
183 Correct 194 ms 18076 KB Output is correct
184 Correct 277 ms 27456 KB Output is correct
185 Correct 187 ms 15112 KB Output is correct
186 Correct 225 ms 37940 KB Output is correct
187 Correct 249 ms 23712 KB Output is correct
188 Correct 210 ms 71764 KB Output is correct
189 Correct 332 ms 27956 KB Output is correct
190 Correct 241 ms 27216 KB Output is correct
191 Correct 230 ms 72064 KB Output is correct
192 Correct 457 ms 99916 KB Output is correct
193 Correct 352 ms 99892 KB Output is correct
194 Correct 159 ms 38324 KB Output is correct
195 Correct 265 ms 37760 KB Output is correct
196 Correct 375 ms 27368 KB Output is correct
197 Correct 352 ms 28068 KB Output is correct
198 Correct 352 ms 29220 KB Output is correct
199 Correct 382 ms 31576 KB Output is correct
200 Correct 316 ms 28140 KB Output is correct
201 Correct 328 ms 28444 KB Output is correct
202 Correct 268 ms 27644 KB Output is correct
203 Correct 528 ms 52168 KB Output is correct
204 Correct 433 ms 44200 KB Output is correct
205 Correct 546 ms 34196 KB Output is correct
206 Correct 577 ms 53988 KB Output is correct
207 Correct 428 ms 142572 KB Output is correct
208 Correct 649 ms 49984 KB Output is correct
209 Correct 570 ms 54168 KB Output is correct
210 Correct 503 ms 143388 KB Output is correct
211 Correct 850 ms 161364 KB Output is correct
212 Correct 809 ms 164920 KB Output is correct
213 Correct 309 ms 77240 KB Output is correct
214 Correct 554 ms 77252 KB Output is correct
215 Correct 731 ms 52996 KB Output is correct
216 Correct 715 ms 55424 KB Output is correct
217 Correct 726 ms 52632 KB Output is correct
218 Correct 867 ms 58964 KB Output is correct
219 Correct 816 ms 86960 KB Output is correct
220 Correct 847 ms 111796 KB Output is correct
221 Correct 900 ms 151424 KB Output is correct
222 Correct 909 ms 147868 KB Output is correct
223 Correct 691 ms 57096 KB Output is correct
224 Correct 692 ms 51360 KB Output is correct
225 Correct 526 ms 54412 KB Output is correct