#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
const int inf = 1e9+10;
const int maxn = 3e5+10;
const int maxd = 5e6;
int n, m, k;
int szrt[maxn], idrt[maxn], thrt[maxn], isrt[maxn], nxrt[maxn], pvrt[maxn], dlol[maxn];
int fqt1[maxn];
int cntwtf = 0;
vector<int> g[maxn], gdiffrt[maxn], d[maxn];
vector<pair<int,int>> withdist[maxd+1];
int32_t main() {
// freopen("in.in", "r", stdin);
cin >> n >> m;
for(int i = 1; i <= m; i++) {
int u,v; cin >> u >> v;
g[u].pb(v);
g[v].pb(u);
}
cin >> k;
for(int i = 1; i <= k; i++) {
cin >> szrt[i];
for(int j = 0; j < szrt[i]; j++) {
int v; cin >> v;
idrt[v] = i;
isrt[v] = 1;
thrt[v] = j;
}
}
szrt[0] = 1;
for(int i = 1; i <= n; i++) {
dlol[i] = inf;
if(isrt[i]) {
for(int j = 0; j < szrt[idrt[i]]; j++) {
d[i].pb(inf);
}
int u = i;
for(auto v : g[u]) {
if(isrt[v] && idrt[u] == idrt[v] && thrt[v] == (thrt[u]+1)%szrt[idrt[u]]) {
nxrt[u] = v;
}
if(isrt[v] && idrt[u] == idrt[v] && thrt[u] == (thrt[v]+1)%szrt[idrt[u]]) {
pvrt[u] = v;
}
if(isrt[v] && idrt[v] != idrt[u]) {
gdiffrt[u].pb(v);
}
}
}
else {
d[i].pb(inf);
}
}
d[1][0] = 0;
withdist[0].pb(mp(1,0));
for(int distcur = 0; distcur <= maxd; distcur++) {
while(withdist[distcur].size()) {
auto X = withdist[distcur].back();
withdist[distcur].pop_back();
int u = X.fr;
int t = X.sc;
if(t != -1 && distcur != d[u][t]) continue;
if(t == -1 && distcur != dlol[u]) continue;
if(t == -1) {
for(auto v : g[u]) {
if(isrt[v]) {
int d1 = dlol[u]+1;
int t1 = d1%szrt[idrt[v]];
// Vou encontrar o guarda em v ou indo para v
// indo para v == u é depois de v e em t1 ele vai estar em u
if(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u]) && idrt[u] == idrt[v]) continue;
if(d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
}
else {
int d1 = dlol[u]+1;
int t1 = 0;
if(d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
}
}
continue;
}
if(isrt[u]) {
int v,d1,t1;
v = nxrt[u];
d1 = d[u][t]+1;
t1 = d1%szrt[idrt[v]];
// Vou encontrar o guarda em v ou indo para v
// indo para v == u é depois de v e em t1 ele vai estar em u
if(!(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u] && idrt[u] == idrt[v])) && d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
v = pvrt[u];
d1 = d[u][t]+1;
t1 = d1%szrt[idrt[v]];
// Vou encontrar o guarda em v ou indo para v
// indo para v == u é depois de v e em t1 ele vai estar em u
if(!(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u] && idrt[u] == idrt[v])) && d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
if(dlol[u] > d[u][t]) {
dlol[u] = d[u][t];
withdist[dlol[u]].pb(mp(u,-1));
}
v = u;
d1 = d[u][t]+1;
t1 = d1%szrt[idrt[v]];
if(!(t1 == thrt[v]) && d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
for(auto v : gdiffrt[u]) {
d1 = d[u][t]+1;
++cntwtf;
while(true) {
int t1 = d1%szrt[idrt[v]];
if(fqt1[t1] == cntwtf) break;
fqt1[t1] = cntwtf;
// Vou encontrar o guarda em v ou indo para v
// indo para v == u é depois de v e em t1 ele vai estar em u
if(d[v][t1] > d1 && t1 != thrt[v]) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
d1+= szrt[idrt[u]];
}
}
}
else {
for(auto v : g[u]) {
if(isrt[v]) {
// d[u][t]+1+i = (thrt[v]+1) MOD
// i = trrt[v]-d[u][t] MOD
int i = ((thrt[v]-d[u][t])%szrt[idrt[v]]+szrt[idrt[v]])%szrt[idrt[v]];
int d1 = d[u][t]+1+i;
int t1 = d1%szrt[idrt[v]];
if(t1 == thrt[v]) continue;
if(d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
d1 = d[u][t]+1;
t1 = d1%szrt[idrt[v]];
if(t1 == thrt[v]) continue;
if(d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
}
else {
int d1 = d[u][t]+1;
int t1 = 0;
if(d[v][t1] > d1) {
d[v][t1] = d1;
withdist[d[v][t1]].pb(mp(v,t1));
}
}
}
}
}
}
if(d[n][0] == inf) cout << "impossible" << endl;
else cout << d[n][0] << endl;
}
Compilation message
watchmen.cpp: In function 'int32_t main()':
watchmen.cpp:87:97: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
87 | if(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u]) && idrt[u] == idrt[v]) continue;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
118 ms |
140488 KB |
Output is correct |
2 |
Correct |
223 ms |
151192 KB |
Output is correct |
3 |
Correct |
222 ms |
149752 KB |
Output is correct |
4 |
Correct |
196 ms |
149516 KB |
Output is correct |
5 |
Correct |
88 ms |
139072 KB |
Output is correct |
6 |
Correct |
198 ms |
149588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
140492 KB |
Output is correct |
2 |
Correct |
235 ms |
151284 KB |
Output is correct |
3 |
Correct |
212 ms |
149860 KB |
Output is correct |
4 |
Correct |
195 ms |
149544 KB |
Output is correct |
5 |
Correct |
105 ms |
139052 KB |
Output is correct |
6 |
Correct |
201 ms |
149656 KB |
Output is correct |
7 |
Correct |
199 ms |
149892 KB |
Output is correct |
8 |
Correct |
200 ms |
149968 KB |
Output is correct |
9 |
Correct |
246 ms |
150152 KB |
Output is correct |
10 |
Correct |
238 ms |
148940 KB |
Output is correct |
11 |
Correct |
235 ms |
148428 KB |
Output is correct |
12 |
Correct |
204 ms |
149472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
140492 KB |
Output is correct |
2 |
Correct |
235 ms |
151284 KB |
Output is correct |
3 |
Correct |
212 ms |
149860 KB |
Output is correct |
4 |
Correct |
195 ms |
149544 KB |
Output is correct |
5 |
Correct |
105 ms |
139052 KB |
Output is correct |
6 |
Correct |
201 ms |
149656 KB |
Output is correct |
7 |
Correct |
199 ms |
149892 KB |
Output is correct |
8 |
Correct |
200 ms |
149968 KB |
Output is correct |
9 |
Correct |
246 ms |
150152 KB |
Output is correct |
10 |
Correct |
238 ms |
148940 KB |
Output is correct |
11 |
Correct |
235 ms |
148428 KB |
Output is correct |
12 |
Correct |
204 ms |
149472 KB |
Output is correct |
13 |
Correct |
122 ms |
140492 KB |
Output is correct |
14 |
Correct |
215 ms |
151244 KB |
Output is correct |
15 |
Correct |
189 ms |
149836 KB |
Output is correct |
16 |
Correct |
230 ms |
149588 KB |
Output is correct |
17 |
Correct |
94 ms |
139100 KB |
Output is correct |
18 |
Correct |
211 ms |
149708 KB |
Output is correct |
19 |
Correct |
204 ms |
149852 KB |
Output is correct |
20 |
Correct |
202 ms |
149912 KB |
Output is correct |
21 |
Correct |
211 ms |
150348 KB |
Output is correct |
22 |
Correct |
190 ms |
148936 KB |
Output is correct |
23 |
Correct |
216 ms |
148464 KB |
Output is correct |
24 |
Correct |
217 ms |
149548 KB |
Output is correct |
25 |
Correct |
3469 ms |
208496 KB |
Output is correct |
26 |
Correct |
3226 ms |
214056 KB |
Output is correct |
27 |
Correct |
3026 ms |
209488 KB |
Output is correct |
28 |
Correct |
2775 ms |
213688 KB |
Output is correct |
29 |
Correct |
2833 ms |
200932 KB |
Output is correct |
30 |
Correct |
2932 ms |
205572 KB |
Output is correct |
31 |
Correct |
3217 ms |
213916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
140492 KB |
Output is correct |
2 |
Correct |
235 ms |
151284 KB |
Output is correct |
3 |
Correct |
212 ms |
149860 KB |
Output is correct |
4 |
Correct |
195 ms |
149544 KB |
Output is correct |
5 |
Correct |
105 ms |
139052 KB |
Output is correct |
6 |
Correct |
201 ms |
149656 KB |
Output is correct |
7 |
Correct |
199 ms |
149892 KB |
Output is correct |
8 |
Correct |
200 ms |
149968 KB |
Output is correct |
9 |
Correct |
246 ms |
150152 KB |
Output is correct |
10 |
Correct |
238 ms |
148940 KB |
Output is correct |
11 |
Correct |
235 ms |
148428 KB |
Output is correct |
12 |
Correct |
204 ms |
149472 KB |
Output is correct |
13 |
Correct |
122 ms |
140492 KB |
Output is correct |
14 |
Correct |
215 ms |
151244 KB |
Output is correct |
15 |
Correct |
189 ms |
149836 KB |
Output is correct |
16 |
Correct |
230 ms |
149588 KB |
Output is correct |
17 |
Correct |
94 ms |
139100 KB |
Output is correct |
18 |
Correct |
211 ms |
149708 KB |
Output is correct |
19 |
Correct |
204 ms |
149852 KB |
Output is correct |
20 |
Correct |
202 ms |
149912 KB |
Output is correct |
21 |
Correct |
211 ms |
150348 KB |
Output is correct |
22 |
Correct |
190 ms |
148936 KB |
Output is correct |
23 |
Correct |
216 ms |
148464 KB |
Output is correct |
24 |
Correct |
217 ms |
149548 KB |
Output is correct |
25 |
Correct |
3469 ms |
208496 KB |
Output is correct |
26 |
Correct |
3226 ms |
214056 KB |
Output is correct |
27 |
Correct |
3026 ms |
209488 KB |
Output is correct |
28 |
Correct |
2775 ms |
213688 KB |
Output is correct |
29 |
Correct |
2833 ms |
200932 KB |
Output is correct |
30 |
Correct |
2932 ms |
205572 KB |
Output is correct |
31 |
Correct |
3217 ms |
213916 KB |
Output is correct |
32 |
Correct |
130 ms |
140440 KB |
Output is correct |
33 |
Correct |
246 ms |
151356 KB |
Output is correct |
34 |
Correct |
204 ms |
149808 KB |
Output is correct |
35 |
Correct |
188 ms |
149688 KB |
Output is correct |
36 |
Correct |
91 ms |
139096 KB |
Output is correct |
37 |
Correct |
244 ms |
149656 KB |
Output is correct |
38 |
Correct |
215 ms |
149892 KB |
Output is correct |
39 |
Correct |
202 ms |
149964 KB |
Output is correct |
40 |
Correct |
199 ms |
150164 KB |
Output is correct |
41 |
Correct |
208 ms |
148972 KB |
Output is correct |
42 |
Correct |
192 ms |
148488 KB |
Output is correct |
43 |
Correct |
197 ms |
149544 KB |
Output is correct |
44 |
Correct |
3244 ms |
205568 KB |
Output is correct |
45 |
Correct |
2992 ms |
207248 KB |
Output is correct |
46 |
Correct |
2941 ms |
200160 KB |
Output is correct |
47 |
Correct |
2738 ms |
217536 KB |
Output is correct |
48 |
Correct |
2903 ms |
191564 KB |
Output is correct |
49 |
Correct |
3070 ms |
202292 KB |
Output is correct |
50 |
Correct |
3080 ms |
207236 KB |
Output is correct |
51 |
Correct |
3051 ms |
244004 KB |
Output is correct |
52 |
Correct |
3110 ms |
275664 KB |
Output is correct |
53 |
Correct |
2914 ms |
243072 KB |
Output is correct |
54 |
Correct |
2250 ms |
220188 KB |
Output is correct |
55 |
Correct |
2783 ms |
236036 KB |
Output is correct |
56 |
Correct |
2799 ms |
217664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
118 ms |
140488 KB |
Output is correct |
2 |
Correct |
223 ms |
151192 KB |
Output is correct |
3 |
Correct |
222 ms |
149752 KB |
Output is correct |
4 |
Correct |
196 ms |
149516 KB |
Output is correct |
5 |
Correct |
88 ms |
139072 KB |
Output is correct |
6 |
Correct |
198 ms |
149588 KB |
Output is correct |
7 |
Correct |
126 ms |
140492 KB |
Output is correct |
8 |
Correct |
235 ms |
151284 KB |
Output is correct |
9 |
Correct |
212 ms |
149860 KB |
Output is correct |
10 |
Correct |
195 ms |
149544 KB |
Output is correct |
11 |
Correct |
105 ms |
139052 KB |
Output is correct |
12 |
Correct |
201 ms |
149656 KB |
Output is correct |
13 |
Correct |
199 ms |
149892 KB |
Output is correct |
14 |
Correct |
200 ms |
149968 KB |
Output is correct |
15 |
Correct |
246 ms |
150152 KB |
Output is correct |
16 |
Correct |
238 ms |
148940 KB |
Output is correct |
17 |
Correct |
235 ms |
148428 KB |
Output is correct |
18 |
Correct |
204 ms |
149472 KB |
Output is correct |
19 |
Correct |
86 ms |
138888 KB |
Output is correct |
20 |
Correct |
88 ms |
138828 KB |
Output is correct |
21 |
Correct |
86 ms |
138868 KB |
Output is correct |
22 |
Correct |
122 ms |
140528 KB |
Output is correct |
23 |
Correct |
195 ms |
151192 KB |
Output is correct |
24 |
Correct |
190 ms |
149864 KB |
Output is correct |
25 |
Correct |
183 ms |
149516 KB |
Output is correct |
26 |
Correct |
89 ms |
139068 KB |
Output is correct |
27 |
Correct |
199 ms |
149772 KB |
Output is correct |
28 |
Correct |
210 ms |
149884 KB |
Output is correct |
29 |
Correct |
196 ms |
150000 KB |
Output is correct |
30 |
Correct |
184 ms |
150092 KB |
Output is correct |
31 |
Correct |
188 ms |
148888 KB |
Output is correct |
32 |
Correct |
189 ms |
148468 KB |
Output is correct |
33 |
Correct |
199 ms |
149448 KB |
Output is correct |
34 |
Correct |
2788 ms |
194952 KB |
Output is correct |
35 |
Correct |
2917 ms |
201196 KB |
Output is correct |
36 |
Correct |
2881 ms |
192420 KB |
Output is correct |
37 |
Correct |
2624 ms |
197732 KB |
Output is correct |
38 |
Correct |
2714 ms |
201752 KB |
Output is correct |
39 |
Correct |
2582 ms |
195984 KB |
Output is correct |
40 |
Correct |
2751 ms |
198884 KB |
Output is correct |
41 |
Correct |
2617 ms |
196180 KB |
Output is correct |
42 |
Correct |
2746 ms |
202140 KB |
Output is correct |
43 |
Correct |
2775 ms |
202876 KB |
Output is correct |
44 |
Correct |
2781 ms |
204812 KB |
Output is correct |
45 |
Correct |
2883 ms |
200148 KB |
Output is correct |
46 |
Correct |
2826 ms |
203844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
118 ms |
140488 KB |
Output is correct |
2 |
Correct |
223 ms |
151192 KB |
Output is correct |
3 |
Correct |
222 ms |
149752 KB |
Output is correct |
4 |
Correct |
196 ms |
149516 KB |
Output is correct |
5 |
Correct |
88 ms |
139072 KB |
Output is correct |
6 |
Correct |
198 ms |
149588 KB |
Output is correct |
7 |
Correct |
126 ms |
140492 KB |
Output is correct |
8 |
Correct |
235 ms |
151284 KB |
Output is correct |
9 |
Correct |
212 ms |
149860 KB |
Output is correct |
10 |
Correct |
195 ms |
149544 KB |
Output is correct |
11 |
Correct |
105 ms |
139052 KB |
Output is correct |
12 |
Correct |
201 ms |
149656 KB |
Output is correct |
13 |
Correct |
199 ms |
149892 KB |
Output is correct |
14 |
Correct |
200 ms |
149968 KB |
Output is correct |
15 |
Correct |
246 ms |
150152 KB |
Output is correct |
16 |
Correct |
238 ms |
148940 KB |
Output is correct |
17 |
Correct |
235 ms |
148428 KB |
Output is correct |
18 |
Correct |
204 ms |
149472 KB |
Output is correct |
19 |
Correct |
122 ms |
140492 KB |
Output is correct |
20 |
Correct |
215 ms |
151244 KB |
Output is correct |
21 |
Correct |
189 ms |
149836 KB |
Output is correct |
22 |
Correct |
230 ms |
149588 KB |
Output is correct |
23 |
Correct |
94 ms |
139100 KB |
Output is correct |
24 |
Correct |
211 ms |
149708 KB |
Output is correct |
25 |
Correct |
204 ms |
149852 KB |
Output is correct |
26 |
Correct |
202 ms |
149912 KB |
Output is correct |
27 |
Correct |
211 ms |
150348 KB |
Output is correct |
28 |
Correct |
190 ms |
148936 KB |
Output is correct |
29 |
Correct |
216 ms |
148464 KB |
Output is correct |
30 |
Correct |
217 ms |
149548 KB |
Output is correct |
31 |
Correct |
3469 ms |
208496 KB |
Output is correct |
32 |
Correct |
3226 ms |
214056 KB |
Output is correct |
33 |
Correct |
3026 ms |
209488 KB |
Output is correct |
34 |
Correct |
2775 ms |
213688 KB |
Output is correct |
35 |
Correct |
2833 ms |
200932 KB |
Output is correct |
36 |
Correct |
2932 ms |
205572 KB |
Output is correct |
37 |
Correct |
3217 ms |
213916 KB |
Output is correct |
38 |
Correct |
86 ms |
138888 KB |
Output is correct |
39 |
Correct |
88 ms |
138828 KB |
Output is correct |
40 |
Correct |
86 ms |
138868 KB |
Output is correct |
41 |
Correct |
122 ms |
140528 KB |
Output is correct |
42 |
Correct |
195 ms |
151192 KB |
Output is correct |
43 |
Correct |
190 ms |
149864 KB |
Output is correct |
44 |
Correct |
183 ms |
149516 KB |
Output is correct |
45 |
Correct |
89 ms |
139068 KB |
Output is correct |
46 |
Correct |
199 ms |
149772 KB |
Output is correct |
47 |
Correct |
210 ms |
149884 KB |
Output is correct |
48 |
Correct |
196 ms |
150000 KB |
Output is correct |
49 |
Correct |
184 ms |
150092 KB |
Output is correct |
50 |
Correct |
188 ms |
148888 KB |
Output is correct |
51 |
Correct |
189 ms |
148468 KB |
Output is correct |
52 |
Correct |
199 ms |
149448 KB |
Output is correct |
53 |
Correct |
2788 ms |
194952 KB |
Output is correct |
54 |
Correct |
2917 ms |
201196 KB |
Output is correct |
55 |
Correct |
2881 ms |
192420 KB |
Output is correct |
56 |
Correct |
2624 ms |
197732 KB |
Output is correct |
57 |
Correct |
2714 ms |
201752 KB |
Output is correct |
58 |
Correct |
2582 ms |
195984 KB |
Output is correct |
59 |
Correct |
2751 ms |
198884 KB |
Output is correct |
60 |
Correct |
2617 ms |
196180 KB |
Output is correct |
61 |
Correct |
2746 ms |
202140 KB |
Output is correct |
62 |
Correct |
2775 ms |
202876 KB |
Output is correct |
63 |
Correct |
2781 ms |
204812 KB |
Output is correct |
64 |
Correct |
2883 ms |
200148 KB |
Output is correct |
65 |
Correct |
2826 ms |
203844 KB |
Output is correct |
66 |
Correct |
90 ms |
138872 KB |
Output is correct |
67 |
Correct |
89 ms |
138816 KB |
Output is correct |
68 |
Correct |
94 ms |
138844 KB |
Output is correct |
69 |
Correct |
119 ms |
140512 KB |
Output is correct |
70 |
Correct |
201 ms |
151184 KB |
Output is correct |
71 |
Correct |
182 ms |
149872 KB |
Output is correct |
72 |
Correct |
187 ms |
149540 KB |
Output is correct |
73 |
Correct |
87 ms |
139076 KB |
Output is correct |
74 |
Correct |
189 ms |
149556 KB |
Output is correct |
75 |
Correct |
187 ms |
149808 KB |
Output is correct |
76 |
Correct |
188 ms |
149964 KB |
Output is correct |
77 |
Correct |
190 ms |
150104 KB |
Output is correct |
78 |
Correct |
186 ms |
148976 KB |
Output is correct |
79 |
Correct |
179 ms |
148380 KB |
Output is correct |
80 |
Correct |
187 ms |
149508 KB |
Output is correct |
81 |
Correct |
2711 ms |
198560 KB |
Output is correct |
82 |
Correct |
2587 ms |
204940 KB |
Output is correct |
83 |
Correct |
2543 ms |
201060 KB |
Output is correct |
84 |
Correct |
2273 ms |
208400 KB |
Output is correct |
85 |
Correct |
2594 ms |
200768 KB |
Output is correct |
86 |
Correct |
2505 ms |
203268 KB |
Output is correct |
87 |
Correct |
2856 ms |
204640 KB |
Output is correct |
88 |
Correct |
2700 ms |
196708 KB |
Output is correct |
89 |
Correct |
3370 ms |
190900 KB |
Output is correct |
90 |
Correct |
2805 ms |
199056 KB |
Output is correct |
91 |
Correct |
2575 ms |
199432 KB |
Output is correct |
92 |
Correct |
2743 ms |
198188 KB |
Output is correct |
93 |
Correct |
2515 ms |
196504 KB |
Output is correct |
94 |
Correct |
2907 ms |
192964 KB |
Output is correct |
95 |
Correct |
2563 ms |
194112 KB |
Output is correct |
96 |
Correct |
2654 ms |
196536 KB |
Output is correct |
97 |
Correct |
2719 ms |
197600 KB |
Output is correct |
98 |
Correct |
2897 ms |
199220 KB |
Output is correct |
99 |
Correct |
2811 ms |
193612 KB |
Output is correct |
100 |
Correct |
2734 ms |
196008 KB |
Output is correct |
101 |
Correct |
2667 ms |
196368 KB |
Output is correct |
102 |
Correct |
2525 ms |
198572 KB |
Output is correct |
103 |
Correct |
2679 ms |
198032 KB |
Output is correct |
104 |
Execution timed out |
6039 ms |
197864 KB |
Time limit exceeded |
105 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
118 ms |
140488 KB |
Output is correct |
2 |
Correct |
223 ms |
151192 KB |
Output is correct |
3 |
Correct |
222 ms |
149752 KB |
Output is correct |
4 |
Correct |
196 ms |
149516 KB |
Output is correct |
5 |
Correct |
88 ms |
139072 KB |
Output is correct |
6 |
Correct |
198 ms |
149588 KB |
Output is correct |
7 |
Correct |
126 ms |
140492 KB |
Output is correct |
8 |
Correct |
235 ms |
151284 KB |
Output is correct |
9 |
Correct |
212 ms |
149860 KB |
Output is correct |
10 |
Correct |
195 ms |
149544 KB |
Output is correct |
11 |
Correct |
105 ms |
139052 KB |
Output is correct |
12 |
Correct |
201 ms |
149656 KB |
Output is correct |
13 |
Correct |
199 ms |
149892 KB |
Output is correct |
14 |
Correct |
200 ms |
149968 KB |
Output is correct |
15 |
Correct |
246 ms |
150152 KB |
Output is correct |
16 |
Correct |
238 ms |
148940 KB |
Output is correct |
17 |
Correct |
235 ms |
148428 KB |
Output is correct |
18 |
Correct |
204 ms |
149472 KB |
Output is correct |
19 |
Correct |
122 ms |
140492 KB |
Output is correct |
20 |
Correct |
215 ms |
151244 KB |
Output is correct |
21 |
Correct |
189 ms |
149836 KB |
Output is correct |
22 |
Correct |
230 ms |
149588 KB |
Output is correct |
23 |
Correct |
94 ms |
139100 KB |
Output is correct |
24 |
Correct |
211 ms |
149708 KB |
Output is correct |
25 |
Correct |
204 ms |
149852 KB |
Output is correct |
26 |
Correct |
202 ms |
149912 KB |
Output is correct |
27 |
Correct |
211 ms |
150348 KB |
Output is correct |
28 |
Correct |
190 ms |
148936 KB |
Output is correct |
29 |
Correct |
216 ms |
148464 KB |
Output is correct |
30 |
Correct |
217 ms |
149548 KB |
Output is correct |
31 |
Correct |
3469 ms |
208496 KB |
Output is correct |
32 |
Correct |
3226 ms |
214056 KB |
Output is correct |
33 |
Correct |
3026 ms |
209488 KB |
Output is correct |
34 |
Correct |
2775 ms |
213688 KB |
Output is correct |
35 |
Correct |
2833 ms |
200932 KB |
Output is correct |
36 |
Correct |
2932 ms |
205572 KB |
Output is correct |
37 |
Correct |
3217 ms |
213916 KB |
Output is correct |
38 |
Correct |
130 ms |
140440 KB |
Output is correct |
39 |
Correct |
246 ms |
151356 KB |
Output is correct |
40 |
Correct |
204 ms |
149808 KB |
Output is correct |
41 |
Correct |
188 ms |
149688 KB |
Output is correct |
42 |
Correct |
91 ms |
139096 KB |
Output is correct |
43 |
Correct |
244 ms |
149656 KB |
Output is correct |
44 |
Correct |
215 ms |
149892 KB |
Output is correct |
45 |
Correct |
202 ms |
149964 KB |
Output is correct |
46 |
Correct |
199 ms |
150164 KB |
Output is correct |
47 |
Correct |
208 ms |
148972 KB |
Output is correct |
48 |
Correct |
192 ms |
148488 KB |
Output is correct |
49 |
Correct |
197 ms |
149544 KB |
Output is correct |
50 |
Correct |
3244 ms |
205568 KB |
Output is correct |
51 |
Correct |
2992 ms |
207248 KB |
Output is correct |
52 |
Correct |
2941 ms |
200160 KB |
Output is correct |
53 |
Correct |
2738 ms |
217536 KB |
Output is correct |
54 |
Correct |
2903 ms |
191564 KB |
Output is correct |
55 |
Correct |
3070 ms |
202292 KB |
Output is correct |
56 |
Correct |
3080 ms |
207236 KB |
Output is correct |
57 |
Correct |
3051 ms |
244004 KB |
Output is correct |
58 |
Correct |
3110 ms |
275664 KB |
Output is correct |
59 |
Correct |
2914 ms |
243072 KB |
Output is correct |
60 |
Correct |
2250 ms |
220188 KB |
Output is correct |
61 |
Correct |
2783 ms |
236036 KB |
Output is correct |
62 |
Correct |
2799 ms |
217664 KB |
Output is correct |
63 |
Correct |
86 ms |
138888 KB |
Output is correct |
64 |
Correct |
88 ms |
138828 KB |
Output is correct |
65 |
Correct |
86 ms |
138868 KB |
Output is correct |
66 |
Correct |
122 ms |
140528 KB |
Output is correct |
67 |
Correct |
195 ms |
151192 KB |
Output is correct |
68 |
Correct |
190 ms |
149864 KB |
Output is correct |
69 |
Correct |
183 ms |
149516 KB |
Output is correct |
70 |
Correct |
89 ms |
139068 KB |
Output is correct |
71 |
Correct |
199 ms |
149772 KB |
Output is correct |
72 |
Correct |
210 ms |
149884 KB |
Output is correct |
73 |
Correct |
196 ms |
150000 KB |
Output is correct |
74 |
Correct |
184 ms |
150092 KB |
Output is correct |
75 |
Correct |
188 ms |
148888 KB |
Output is correct |
76 |
Correct |
189 ms |
148468 KB |
Output is correct |
77 |
Correct |
199 ms |
149448 KB |
Output is correct |
78 |
Correct |
2788 ms |
194952 KB |
Output is correct |
79 |
Correct |
2917 ms |
201196 KB |
Output is correct |
80 |
Correct |
2881 ms |
192420 KB |
Output is correct |
81 |
Correct |
2624 ms |
197732 KB |
Output is correct |
82 |
Correct |
2714 ms |
201752 KB |
Output is correct |
83 |
Correct |
2582 ms |
195984 KB |
Output is correct |
84 |
Correct |
2751 ms |
198884 KB |
Output is correct |
85 |
Correct |
2617 ms |
196180 KB |
Output is correct |
86 |
Correct |
2746 ms |
202140 KB |
Output is correct |
87 |
Correct |
2775 ms |
202876 KB |
Output is correct |
88 |
Correct |
2781 ms |
204812 KB |
Output is correct |
89 |
Correct |
2883 ms |
200148 KB |
Output is correct |
90 |
Correct |
2826 ms |
203844 KB |
Output is correct |
91 |
Correct |
90 ms |
138872 KB |
Output is correct |
92 |
Correct |
89 ms |
138816 KB |
Output is correct |
93 |
Correct |
94 ms |
138844 KB |
Output is correct |
94 |
Correct |
119 ms |
140512 KB |
Output is correct |
95 |
Correct |
201 ms |
151184 KB |
Output is correct |
96 |
Correct |
182 ms |
149872 KB |
Output is correct |
97 |
Correct |
187 ms |
149540 KB |
Output is correct |
98 |
Correct |
87 ms |
139076 KB |
Output is correct |
99 |
Correct |
189 ms |
149556 KB |
Output is correct |
100 |
Correct |
187 ms |
149808 KB |
Output is correct |
101 |
Correct |
188 ms |
149964 KB |
Output is correct |
102 |
Correct |
190 ms |
150104 KB |
Output is correct |
103 |
Correct |
186 ms |
148976 KB |
Output is correct |
104 |
Correct |
179 ms |
148380 KB |
Output is correct |
105 |
Correct |
187 ms |
149508 KB |
Output is correct |
106 |
Correct |
2711 ms |
198560 KB |
Output is correct |
107 |
Correct |
2587 ms |
204940 KB |
Output is correct |
108 |
Correct |
2543 ms |
201060 KB |
Output is correct |
109 |
Correct |
2273 ms |
208400 KB |
Output is correct |
110 |
Correct |
2594 ms |
200768 KB |
Output is correct |
111 |
Correct |
2505 ms |
203268 KB |
Output is correct |
112 |
Correct |
2856 ms |
204640 KB |
Output is correct |
113 |
Correct |
2700 ms |
196708 KB |
Output is correct |
114 |
Correct |
3370 ms |
190900 KB |
Output is correct |
115 |
Correct |
2805 ms |
199056 KB |
Output is correct |
116 |
Correct |
2575 ms |
199432 KB |
Output is correct |
117 |
Correct |
2743 ms |
198188 KB |
Output is correct |
118 |
Correct |
2515 ms |
196504 KB |
Output is correct |
119 |
Correct |
2907 ms |
192964 KB |
Output is correct |
120 |
Correct |
2563 ms |
194112 KB |
Output is correct |
121 |
Correct |
2654 ms |
196536 KB |
Output is correct |
122 |
Correct |
2719 ms |
197600 KB |
Output is correct |
123 |
Correct |
2897 ms |
199220 KB |
Output is correct |
124 |
Correct |
2811 ms |
193612 KB |
Output is correct |
125 |
Correct |
2734 ms |
196008 KB |
Output is correct |
126 |
Correct |
2667 ms |
196368 KB |
Output is correct |
127 |
Correct |
2525 ms |
198572 KB |
Output is correct |
128 |
Correct |
2679 ms |
198032 KB |
Output is correct |
129 |
Execution timed out |
6039 ms |
197864 KB |
Time limit exceeded |
130 |
Halted |
0 ms |
0 KB |
- |