#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 250'010;
const int L = 1600;
bool has_watch[N];
int watch_size[N];
int watch_ind[N];
int watch_guard[N];
int watch_size_list[L];
int n, m, k;
int *nxt[L][L];
void calc_nxt(int step, int size)
{
if (nxt[step][size])
return;
nxt[step][size] = new int[size];
int cnt = 0;
for (int beg=0; cnt < size; ++beg) {
vector<pii> vec;
int x = beg;
do {
while (vec.size() && vec.back().first > x)
vec.pop_back();
nxt[step][size][x] = vec.size()?
cnt - vec.back().second:
-1;
vec.push_back({x, cnt});
++cnt;
x = x-step%size;
x = x<0?x+size:x;
} while (x != beg);
}
}
vector<int> A[N];
int norm_dis[N];
void bfs(int s)
{
memset(norm_dis, -1, sizeof(norm_dis));
vector<int> q = {s};
Loop (i,0,q.size()) {
int v = q[i];
for (int u : A[v]) {
if (norm_dis[u] != -1)
continue;
norm_dis[u] = norm_dis[v] + 1;
q.push_back(u);
}
}
}
vector<ll> dis[N];
void upS(int from, int v, ll d, set<tuple<ll,int,int>> &Set)
{
int md = has_watch[v]? d % watch_size[v]: 0;
if (d >= dis[v][md])
return;
if (has_watch[v] && md == watch_ind[v])
return;
if (has_watch[from] && has_watch[v] && watch_guard[from] == watch_guard[v] && watch_ind[from] == md && (watch_ind[v] == md-1 || watch_ind[v] == md+watch_size[v]-1))
return;
Set.erase ({dis[v][md]+norm_dis[v], md, v});
dis[v][md] = d;
Set.insert({dis[v][md]+norm_dis[v], md, v});
}
void up3(int v, int u, ll d, set<tuple<ll,int,int>> &Set)
{
int step = watch_size[v];
int size = watch_size[u];
int x = (d + size - watch_ind[u]) % size;
for (;;) {
upS(v, u, d+1, Set);
ll cnt = nxt[step][size][x];
if (cnt == -1)
break;
d += cnt*step;
x = (x + cnt*step) % size;
}
}
ll dij(int s, int t)
{
set<tuple<ll,int,int>> Set;
Loop (i,0,N)
dis[i] = vector<ll>(has_watch[i]?watch_size[i]:1, (ll)1e17);
dis[s][0] = 0;
Set.insert({dis[s][0]+norm_dis[s], 0, s});
while (Set.size()) {
auto [dard, md, v] = *Set.begin();
Set.erase(Set.begin());
ll d = dis[v][md];
if (v == t)
return d;
upS(v, v, d+1, Set);
for (int u : A[v]) {
if (has_watch[u] && has_watch[v]) {
up3(v, u, d, Set);
} else if (has_watch[u]) {
upS(v, u, d+1, Set);
int wait = watch_ind[u] - d%watch_size[u];
wait = wait<0?wait+watch_size[u]:wait;
upS(v, u, d+1+wait, Set);
} else {
upS(v, u, d+1, Set);
}
}
}
return -1;
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
cin >> n >> m;
Loop (i,0,m) {
int v, u;
cin >> v >> u;
--v; --u;
A[v].push_back(u);
A[u].push_back(v);
}
cin >> k;
Loop (i,0,k) {
int l;
cin >> l;
watch_size_list[i] = l;
Loop (j,0,l) {
int v;
cin >> v;
--v;
watch_size[v] = l;
watch_ind[v] = j;
has_watch[v] = 1;
watch_guard[v] = i;
}
}
Loop (i,0,k) Loop (j,0,k)
calc_nxt(watch_size_list[i], watch_size_list[j]);
bfs(n-1);
ll ans = dij(0, n-1);
if (ans == -1)
cout << "impossible\n";
else
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21844 KB |
Output is correct |
2 |
Correct |
83 ms |
25028 KB |
Output is correct |
3 |
Correct |
73 ms |
24752 KB |
Output is correct |
4 |
Correct |
68 ms |
25016 KB |
Output is correct |
5 |
Correct |
19 ms |
20948 KB |
Output is correct |
6 |
Correct |
69 ms |
24716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21828 KB |
Output is correct |
2 |
Correct |
96 ms |
25024 KB |
Output is correct |
3 |
Correct |
71 ms |
24792 KB |
Output is correct |
4 |
Correct |
61 ms |
24964 KB |
Output is correct |
5 |
Correct |
19 ms |
21036 KB |
Output is correct |
6 |
Correct |
68 ms |
24700 KB |
Output is correct |
7 |
Correct |
72 ms |
24656 KB |
Output is correct |
8 |
Correct |
93 ms |
25820 KB |
Output is correct |
9 |
Correct |
87 ms |
25952 KB |
Output is correct |
10 |
Correct |
67 ms |
26152 KB |
Output is correct |
11 |
Correct |
55 ms |
25832 KB |
Output is correct |
12 |
Correct |
70 ms |
25768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21828 KB |
Output is correct |
2 |
Correct |
96 ms |
25024 KB |
Output is correct |
3 |
Correct |
71 ms |
24792 KB |
Output is correct |
4 |
Correct |
61 ms |
24964 KB |
Output is correct |
5 |
Correct |
19 ms |
21036 KB |
Output is correct |
6 |
Correct |
68 ms |
24700 KB |
Output is correct |
7 |
Correct |
72 ms |
24656 KB |
Output is correct |
8 |
Correct |
93 ms |
25820 KB |
Output is correct |
9 |
Correct |
87 ms |
25952 KB |
Output is correct |
10 |
Correct |
67 ms |
26152 KB |
Output is correct |
11 |
Correct |
55 ms |
25832 KB |
Output is correct |
12 |
Correct |
70 ms |
25768 KB |
Output is correct |
13 |
Correct |
31 ms |
22480 KB |
Output is correct |
14 |
Correct |
84 ms |
26144 KB |
Output is correct |
15 |
Correct |
72 ms |
25920 KB |
Output is correct |
16 |
Correct |
74 ms |
26128 KB |
Output is correct |
17 |
Correct |
19 ms |
20968 KB |
Output is correct |
18 |
Correct |
72 ms |
25880 KB |
Output is correct |
19 |
Correct |
74 ms |
25736 KB |
Output is correct |
20 |
Correct |
76 ms |
25876 KB |
Output is correct |
21 |
Correct |
94 ms |
26152 KB |
Output is correct |
22 |
Correct |
60 ms |
26032 KB |
Output is correct |
23 |
Correct |
53 ms |
25836 KB |
Output is correct |
24 |
Correct |
68 ms |
25828 KB |
Output is correct |
25 |
Correct |
1451 ms |
104192 KB |
Output is correct |
26 |
Correct |
1478 ms |
108168 KB |
Output is correct |
27 |
Correct |
1388 ms |
103320 KB |
Output is correct |
28 |
Correct |
1070 ms |
106252 KB |
Output is correct |
29 |
Correct |
1475 ms |
102656 KB |
Output is correct |
30 |
Correct |
1421 ms |
102976 KB |
Output is correct |
31 |
Correct |
1477 ms |
109456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21828 KB |
Output is correct |
2 |
Correct |
96 ms |
25024 KB |
Output is correct |
3 |
Correct |
71 ms |
24792 KB |
Output is correct |
4 |
Correct |
61 ms |
24964 KB |
Output is correct |
5 |
Correct |
19 ms |
21036 KB |
Output is correct |
6 |
Correct |
68 ms |
24700 KB |
Output is correct |
7 |
Correct |
72 ms |
24656 KB |
Output is correct |
8 |
Correct |
93 ms |
25820 KB |
Output is correct |
9 |
Correct |
87 ms |
25952 KB |
Output is correct |
10 |
Correct |
67 ms |
26152 KB |
Output is correct |
11 |
Correct |
55 ms |
25832 KB |
Output is correct |
12 |
Correct |
70 ms |
25768 KB |
Output is correct |
13 |
Correct |
31 ms |
22480 KB |
Output is correct |
14 |
Correct |
84 ms |
26144 KB |
Output is correct |
15 |
Correct |
72 ms |
25920 KB |
Output is correct |
16 |
Correct |
74 ms |
26128 KB |
Output is correct |
17 |
Correct |
19 ms |
20968 KB |
Output is correct |
18 |
Correct |
72 ms |
25880 KB |
Output is correct |
19 |
Correct |
74 ms |
25736 KB |
Output is correct |
20 |
Correct |
76 ms |
25876 KB |
Output is correct |
21 |
Correct |
94 ms |
26152 KB |
Output is correct |
22 |
Correct |
60 ms |
26032 KB |
Output is correct |
23 |
Correct |
53 ms |
25836 KB |
Output is correct |
24 |
Correct |
68 ms |
25828 KB |
Output is correct |
25 |
Correct |
1451 ms |
104192 KB |
Output is correct |
26 |
Correct |
1478 ms |
108168 KB |
Output is correct |
27 |
Correct |
1388 ms |
103320 KB |
Output is correct |
28 |
Correct |
1070 ms |
106252 KB |
Output is correct |
29 |
Correct |
1475 ms |
102656 KB |
Output is correct |
30 |
Correct |
1421 ms |
102976 KB |
Output is correct |
31 |
Correct |
1477 ms |
109456 KB |
Output is correct |
32 |
Correct |
33 ms |
22452 KB |
Output is correct |
33 |
Correct |
83 ms |
26188 KB |
Output is correct |
34 |
Correct |
70 ms |
25928 KB |
Output is correct |
35 |
Correct |
75 ms |
26172 KB |
Output is correct |
36 |
Correct |
19 ms |
20948 KB |
Output is correct |
37 |
Correct |
67 ms |
25764 KB |
Output is correct |
38 |
Correct |
74 ms |
25828 KB |
Output is correct |
39 |
Correct |
85 ms |
25816 KB |
Output is correct |
40 |
Correct |
79 ms |
25944 KB |
Output is correct |
41 |
Correct |
66 ms |
26088 KB |
Output is correct |
42 |
Correct |
54 ms |
25816 KB |
Output is correct |
43 |
Correct |
69 ms |
25840 KB |
Output is correct |
44 |
Correct |
1454 ms |
104288 KB |
Output is correct |
45 |
Correct |
1417 ms |
108188 KB |
Output is correct |
46 |
Correct |
1379 ms |
103224 KB |
Output is correct |
47 |
Correct |
1104 ms |
106372 KB |
Output is correct |
48 |
Correct |
1508 ms |
102672 KB |
Output is correct |
49 |
Correct |
1400 ms |
103180 KB |
Output is correct |
50 |
Correct |
1530 ms |
109680 KB |
Output is correct |
51 |
Correct |
1538 ms |
123088 KB |
Output is correct |
52 |
Correct |
1929 ms |
138512 KB |
Output is correct |
53 |
Correct |
1426 ms |
122844 KB |
Output is correct |
54 |
Correct |
1129 ms |
99548 KB |
Output is correct |
55 |
Correct |
1482 ms |
126992 KB |
Output is correct |
56 |
Correct |
1322 ms |
115232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21844 KB |
Output is correct |
2 |
Correct |
83 ms |
25028 KB |
Output is correct |
3 |
Correct |
73 ms |
24752 KB |
Output is correct |
4 |
Correct |
68 ms |
25016 KB |
Output is correct |
5 |
Correct |
19 ms |
20948 KB |
Output is correct |
6 |
Correct |
69 ms |
24716 KB |
Output is correct |
7 |
Correct |
34 ms |
21828 KB |
Output is correct |
8 |
Correct |
96 ms |
25024 KB |
Output is correct |
9 |
Correct |
71 ms |
24792 KB |
Output is correct |
10 |
Correct |
61 ms |
24964 KB |
Output is correct |
11 |
Correct |
19 ms |
21036 KB |
Output is correct |
12 |
Correct |
68 ms |
24700 KB |
Output is correct |
13 |
Correct |
72 ms |
24656 KB |
Output is correct |
14 |
Correct |
93 ms |
25820 KB |
Output is correct |
15 |
Correct |
87 ms |
25952 KB |
Output is correct |
16 |
Correct |
67 ms |
26152 KB |
Output is correct |
17 |
Correct |
55 ms |
25832 KB |
Output is correct |
18 |
Correct |
70 ms |
25768 KB |
Output is correct |
19 |
Correct |
17 ms |
20820 KB |
Output is correct |
20 |
Correct |
17 ms |
20908 KB |
Output is correct |
21 |
Correct |
18 ms |
20820 KB |
Output is correct |
22 |
Correct |
33 ms |
22452 KB |
Output is correct |
23 |
Correct |
91 ms |
26148 KB |
Output is correct |
24 |
Correct |
90 ms |
25908 KB |
Output is correct |
25 |
Correct |
68 ms |
26072 KB |
Output is correct |
26 |
Correct |
20 ms |
21036 KB |
Output is correct |
27 |
Correct |
74 ms |
25828 KB |
Output is correct |
28 |
Correct |
85 ms |
25804 KB |
Output is correct |
29 |
Correct |
77 ms |
25816 KB |
Output is correct |
30 |
Correct |
87 ms |
26024 KB |
Output is correct |
31 |
Correct |
64 ms |
26000 KB |
Output is correct |
32 |
Correct |
58 ms |
25824 KB |
Output is correct |
33 |
Correct |
72 ms |
25828 KB |
Output is correct |
34 |
Correct |
1704 ms |
103916 KB |
Output is correct |
35 |
Correct |
1770 ms |
102464 KB |
Output is correct |
36 |
Correct |
1756 ms |
102552 KB |
Output is correct |
37 |
Correct |
1671 ms |
106948 KB |
Output is correct |
38 |
Correct |
1503 ms |
103464 KB |
Output is correct |
39 |
Correct |
1356 ms |
102972 KB |
Output is correct |
40 |
Correct |
1586 ms |
103336 KB |
Output is correct |
41 |
Correct |
1305 ms |
103188 KB |
Output is correct |
42 |
Correct |
1505 ms |
103560 KB |
Output is correct |
43 |
Correct |
1555 ms |
107764 KB |
Output is correct |
44 |
Correct |
1594 ms |
107924 KB |
Output is correct |
45 |
Correct |
1685 ms |
105500 KB |
Output is correct |
46 |
Correct |
1548 ms |
103332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21844 KB |
Output is correct |
2 |
Correct |
83 ms |
25028 KB |
Output is correct |
3 |
Correct |
73 ms |
24752 KB |
Output is correct |
4 |
Correct |
68 ms |
25016 KB |
Output is correct |
5 |
Correct |
19 ms |
20948 KB |
Output is correct |
6 |
Correct |
69 ms |
24716 KB |
Output is correct |
7 |
Correct |
34 ms |
21828 KB |
Output is correct |
8 |
Correct |
96 ms |
25024 KB |
Output is correct |
9 |
Correct |
71 ms |
24792 KB |
Output is correct |
10 |
Correct |
61 ms |
24964 KB |
Output is correct |
11 |
Correct |
19 ms |
21036 KB |
Output is correct |
12 |
Correct |
68 ms |
24700 KB |
Output is correct |
13 |
Correct |
72 ms |
24656 KB |
Output is correct |
14 |
Correct |
93 ms |
25820 KB |
Output is correct |
15 |
Correct |
87 ms |
25952 KB |
Output is correct |
16 |
Correct |
67 ms |
26152 KB |
Output is correct |
17 |
Correct |
55 ms |
25832 KB |
Output is correct |
18 |
Correct |
70 ms |
25768 KB |
Output is correct |
19 |
Correct |
31 ms |
22480 KB |
Output is correct |
20 |
Correct |
84 ms |
26144 KB |
Output is correct |
21 |
Correct |
72 ms |
25920 KB |
Output is correct |
22 |
Correct |
74 ms |
26128 KB |
Output is correct |
23 |
Correct |
19 ms |
20968 KB |
Output is correct |
24 |
Correct |
72 ms |
25880 KB |
Output is correct |
25 |
Correct |
74 ms |
25736 KB |
Output is correct |
26 |
Correct |
76 ms |
25876 KB |
Output is correct |
27 |
Correct |
94 ms |
26152 KB |
Output is correct |
28 |
Correct |
60 ms |
26032 KB |
Output is correct |
29 |
Correct |
53 ms |
25836 KB |
Output is correct |
30 |
Correct |
68 ms |
25828 KB |
Output is correct |
31 |
Correct |
1451 ms |
104192 KB |
Output is correct |
32 |
Correct |
1478 ms |
108168 KB |
Output is correct |
33 |
Correct |
1388 ms |
103320 KB |
Output is correct |
34 |
Correct |
1070 ms |
106252 KB |
Output is correct |
35 |
Correct |
1475 ms |
102656 KB |
Output is correct |
36 |
Correct |
1421 ms |
102976 KB |
Output is correct |
37 |
Correct |
1477 ms |
109456 KB |
Output is correct |
38 |
Correct |
17 ms |
20820 KB |
Output is correct |
39 |
Correct |
17 ms |
20908 KB |
Output is correct |
40 |
Correct |
18 ms |
20820 KB |
Output is correct |
41 |
Correct |
33 ms |
22452 KB |
Output is correct |
42 |
Correct |
91 ms |
26148 KB |
Output is correct |
43 |
Correct |
90 ms |
25908 KB |
Output is correct |
44 |
Correct |
68 ms |
26072 KB |
Output is correct |
45 |
Correct |
20 ms |
21036 KB |
Output is correct |
46 |
Correct |
74 ms |
25828 KB |
Output is correct |
47 |
Correct |
85 ms |
25804 KB |
Output is correct |
48 |
Correct |
77 ms |
25816 KB |
Output is correct |
49 |
Correct |
87 ms |
26024 KB |
Output is correct |
50 |
Correct |
64 ms |
26000 KB |
Output is correct |
51 |
Correct |
58 ms |
25824 KB |
Output is correct |
52 |
Correct |
72 ms |
25828 KB |
Output is correct |
53 |
Correct |
1704 ms |
103916 KB |
Output is correct |
54 |
Correct |
1770 ms |
102464 KB |
Output is correct |
55 |
Correct |
1756 ms |
102552 KB |
Output is correct |
56 |
Correct |
1671 ms |
106948 KB |
Output is correct |
57 |
Correct |
1503 ms |
103464 KB |
Output is correct |
58 |
Correct |
1356 ms |
102972 KB |
Output is correct |
59 |
Correct |
1586 ms |
103336 KB |
Output is correct |
60 |
Correct |
1305 ms |
103188 KB |
Output is correct |
61 |
Correct |
1505 ms |
103560 KB |
Output is correct |
62 |
Correct |
1555 ms |
107764 KB |
Output is correct |
63 |
Correct |
1594 ms |
107924 KB |
Output is correct |
64 |
Correct |
1685 ms |
105500 KB |
Output is correct |
65 |
Correct |
1548 ms |
103332 KB |
Output is correct |
66 |
Correct |
17 ms |
20904 KB |
Output is correct |
67 |
Correct |
17 ms |
20916 KB |
Output is correct |
68 |
Correct |
20 ms |
20912 KB |
Output is correct |
69 |
Correct |
35 ms |
22476 KB |
Output is correct |
70 |
Correct |
102 ms |
26220 KB |
Output is correct |
71 |
Correct |
73 ms |
25828 KB |
Output is correct |
72 |
Correct |
71 ms |
26176 KB |
Output is correct |
73 |
Correct |
20 ms |
20948 KB |
Output is correct |
74 |
Correct |
70 ms |
25824 KB |
Output is correct |
75 |
Correct |
84 ms |
25804 KB |
Output is correct |
76 |
Correct |
77 ms |
25764 KB |
Output is correct |
77 |
Correct |
102 ms |
25984 KB |
Output is correct |
78 |
Correct |
61 ms |
26000 KB |
Output is correct |
79 |
Correct |
76 ms |
25888 KB |
Output is correct |
80 |
Correct |
78 ms |
25800 KB |
Output is correct |
81 |
Correct |
1500 ms |
104104 KB |
Output is correct |
82 |
Correct |
1485 ms |
107952 KB |
Output is correct |
83 |
Correct |
1409 ms |
103464 KB |
Output is correct |
84 |
Correct |
1137 ms |
106040 KB |
Output is correct |
85 |
Correct |
1571 ms |
102520 KB |
Output is correct |
86 |
Correct |
1445 ms |
102644 KB |
Output is correct |
87 |
Correct |
1584 ms |
109024 KB |
Output is correct |
88 |
Correct |
1787 ms |
103364 KB |
Output is correct |
89 |
Correct |
1799 ms |
102252 KB |
Output is correct |
90 |
Correct |
1788 ms |
102028 KB |
Output is correct |
91 |
Correct |
1603 ms |
106472 KB |
Output is correct |
92 |
Correct |
1555 ms |
103088 KB |
Output is correct |
93 |
Correct |
1400 ms |
102476 KB |
Output is correct |
94 |
Correct |
1711 ms |
102572 KB |
Output is correct |
95 |
Correct |
1448 ms |
102400 KB |
Output is correct |
96 |
Correct |
1599 ms |
102724 KB |
Output is correct |
97 |
Correct |
1664 ms |
107068 KB |
Output is correct |
98 |
Correct |
1633 ms |
107032 KB |
Output is correct |
99 |
Correct |
1744 ms |
104804 KB |
Output is correct |
100 |
Correct |
1588 ms |
102728 KB |
Output is correct |
101 |
Correct |
1811 ms |
104572 KB |
Output is correct |
102 |
Correct |
1659 ms |
107316 KB |
Output is correct |
103 |
Correct |
1542 ms |
104292 KB |
Output is correct |
104 |
Correct |
1592 ms |
106292 KB |
Output is correct |
105 |
Correct |
1585 ms |
104188 KB |
Output is correct |
106 |
Correct |
1803 ms |
106160 KB |
Output is correct |
107 |
Correct |
1620 ms |
104056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
21844 KB |
Output is correct |
2 |
Correct |
83 ms |
25028 KB |
Output is correct |
3 |
Correct |
73 ms |
24752 KB |
Output is correct |
4 |
Correct |
68 ms |
25016 KB |
Output is correct |
5 |
Correct |
19 ms |
20948 KB |
Output is correct |
6 |
Correct |
69 ms |
24716 KB |
Output is correct |
7 |
Correct |
34 ms |
21828 KB |
Output is correct |
8 |
Correct |
96 ms |
25024 KB |
Output is correct |
9 |
Correct |
71 ms |
24792 KB |
Output is correct |
10 |
Correct |
61 ms |
24964 KB |
Output is correct |
11 |
Correct |
19 ms |
21036 KB |
Output is correct |
12 |
Correct |
68 ms |
24700 KB |
Output is correct |
13 |
Correct |
72 ms |
24656 KB |
Output is correct |
14 |
Correct |
93 ms |
25820 KB |
Output is correct |
15 |
Correct |
87 ms |
25952 KB |
Output is correct |
16 |
Correct |
67 ms |
26152 KB |
Output is correct |
17 |
Correct |
55 ms |
25832 KB |
Output is correct |
18 |
Correct |
70 ms |
25768 KB |
Output is correct |
19 |
Correct |
31 ms |
22480 KB |
Output is correct |
20 |
Correct |
84 ms |
26144 KB |
Output is correct |
21 |
Correct |
72 ms |
25920 KB |
Output is correct |
22 |
Correct |
74 ms |
26128 KB |
Output is correct |
23 |
Correct |
19 ms |
20968 KB |
Output is correct |
24 |
Correct |
72 ms |
25880 KB |
Output is correct |
25 |
Correct |
74 ms |
25736 KB |
Output is correct |
26 |
Correct |
76 ms |
25876 KB |
Output is correct |
27 |
Correct |
94 ms |
26152 KB |
Output is correct |
28 |
Correct |
60 ms |
26032 KB |
Output is correct |
29 |
Correct |
53 ms |
25836 KB |
Output is correct |
30 |
Correct |
68 ms |
25828 KB |
Output is correct |
31 |
Correct |
1451 ms |
104192 KB |
Output is correct |
32 |
Correct |
1478 ms |
108168 KB |
Output is correct |
33 |
Correct |
1388 ms |
103320 KB |
Output is correct |
34 |
Correct |
1070 ms |
106252 KB |
Output is correct |
35 |
Correct |
1475 ms |
102656 KB |
Output is correct |
36 |
Correct |
1421 ms |
102976 KB |
Output is correct |
37 |
Correct |
1477 ms |
109456 KB |
Output is correct |
38 |
Correct |
33 ms |
22452 KB |
Output is correct |
39 |
Correct |
83 ms |
26188 KB |
Output is correct |
40 |
Correct |
70 ms |
25928 KB |
Output is correct |
41 |
Correct |
75 ms |
26172 KB |
Output is correct |
42 |
Correct |
19 ms |
20948 KB |
Output is correct |
43 |
Correct |
67 ms |
25764 KB |
Output is correct |
44 |
Correct |
74 ms |
25828 KB |
Output is correct |
45 |
Correct |
85 ms |
25816 KB |
Output is correct |
46 |
Correct |
79 ms |
25944 KB |
Output is correct |
47 |
Correct |
66 ms |
26088 KB |
Output is correct |
48 |
Correct |
54 ms |
25816 KB |
Output is correct |
49 |
Correct |
69 ms |
25840 KB |
Output is correct |
50 |
Correct |
1454 ms |
104288 KB |
Output is correct |
51 |
Correct |
1417 ms |
108188 KB |
Output is correct |
52 |
Correct |
1379 ms |
103224 KB |
Output is correct |
53 |
Correct |
1104 ms |
106372 KB |
Output is correct |
54 |
Correct |
1508 ms |
102672 KB |
Output is correct |
55 |
Correct |
1400 ms |
103180 KB |
Output is correct |
56 |
Correct |
1530 ms |
109680 KB |
Output is correct |
57 |
Correct |
1538 ms |
123088 KB |
Output is correct |
58 |
Correct |
1929 ms |
138512 KB |
Output is correct |
59 |
Correct |
1426 ms |
122844 KB |
Output is correct |
60 |
Correct |
1129 ms |
99548 KB |
Output is correct |
61 |
Correct |
1482 ms |
126992 KB |
Output is correct |
62 |
Correct |
1322 ms |
115232 KB |
Output is correct |
63 |
Correct |
17 ms |
20820 KB |
Output is correct |
64 |
Correct |
17 ms |
20908 KB |
Output is correct |
65 |
Correct |
18 ms |
20820 KB |
Output is correct |
66 |
Correct |
33 ms |
22452 KB |
Output is correct |
67 |
Correct |
91 ms |
26148 KB |
Output is correct |
68 |
Correct |
90 ms |
25908 KB |
Output is correct |
69 |
Correct |
68 ms |
26072 KB |
Output is correct |
70 |
Correct |
20 ms |
21036 KB |
Output is correct |
71 |
Correct |
74 ms |
25828 KB |
Output is correct |
72 |
Correct |
85 ms |
25804 KB |
Output is correct |
73 |
Correct |
77 ms |
25816 KB |
Output is correct |
74 |
Correct |
87 ms |
26024 KB |
Output is correct |
75 |
Correct |
64 ms |
26000 KB |
Output is correct |
76 |
Correct |
58 ms |
25824 KB |
Output is correct |
77 |
Correct |
72 ms |
25828 KB |
Output is correct |
78 |
Correct |
1704 ms |
103916 KB |
Output is correct |
79 |
Correct |
1770 ms |
102464 KB |
Output is correct |
80 |
Correct |
1756 ms |
102552 KB |
Output is correct |
81 |
Correct |
1671 ms |
106948 KB |
Output is correct |
82 |
Correct |
1503 ms |
103464 KB |
Output is correct |
83 |
Correct |
1356 ms |
102972 KB |
Output is correct |
84 |
Correct |
1586 ms |
103336 KB |
Output is correct |
85 |
Correct |
1305 ms |
103188 KB |
Output is correct |
86 |
Correct |
1505 ms |
103560 KB |
Output is correct |
87 |
Correct |
1555 ms |
107764 KB |
Output is correct |
88 |
Correct |
1594 ms |
107924 KB |
Output is correct |
89 |
Correct |
1685 ms |
105500 KB |
Output is correct |
90 |
Correct |
1548 ms |
103332 KB |
Output is correct |
91 |
Correct |
17 ms |
20904 KB |
Output is correct |
92 |
Correct |
17 ms |
20916 KB |
Output is correct |
93 |
Correct |
20 ms |
20912 KB |
Output is correct |
94 |
Correct |
35 ms |
22476 KB |
Output is correct |
95 |
Correct |
102 ms |
26220 KB |
Output is correct |
96 |
Correct |
73 ms |
25828 KB |
Output is correct |
97 |
Correct |
71 ms |
26176 KB |
Output is correct |
98 |
Correct |
20 ms |
20948 KB |
Output is correct |
99 |
Correct |
70 ms |
25824 KB |
Output is correct |
100 |
Correct |
84 ms |
25804 KB |
Output is correct |
101 |
Correct |
77 ms |
25764 KB |
Output is correct |
102 |
Correct |
102 ms |
25984 KB |
Output is correct |
103 |
Correct |
61 ms |
26000 KB |
Output is correct |
104 |
Correct |
76 ms |
25888 KB |
Output is correct |
105 |
Correct |
78 ms |
25800 KB |
Output is correct |
106 |
Correct |
1500 ms |
104104 KB |
Output is correct |
107 |
Correct |
1485 ms |
107952 KB |
Output is correct |
108 |
Correct |
1409 ms |
103464 KB |
Output is correct |
109 |
Correct |
1137 ms |
106040 KB |
Output is correct |
110 |
Correct |
1571 ms |
102520 KB |
Output is correct |
111 |
Correct |
1445 ms |
102644 KB |
Output is correct |
112 |
Correct |
1584 ms |
109024 KB |
Output is correct |
113 |
Correct |
1787 ms |
103364 KB |
Output is correct |
114 |
Correct |
1799 ms |
102252 KB |
Output is correct |
115 |
Correct |
1788 ms |
102028 KB |
Output is correct |
116 |
Correct |
1603 ms |
106472 KB |
Output is correct |
117 |
Correct |
1555 ms |
103088 KB |
Output is correct |
118 |
Correct |
1400 ms |
102476 KB |
Output is correct |
119 |
Correct |
1711 ms |
102572 KB |
Output is correct |
120 |
Correct |
1448 ms |
102400 KB |
Output is correct |
121 |
Correct |
1599 ms |
102724 KB |
Output is correct |
122 |
Correct |
1664 ms |
107068 KB |
Output is correct |
123 |
Correct |
1633 ms |
107032 KB |
Output is correct |
124 |
Correct |
1744 ms |
104804 KB |
Output is correct |
125 |
Correct |
1588 ms |
102728 KB |
Output is correct |
126 |
Correct |
1811 ms |
104572 KB |
Output is correct |
127 |
Correct |
1659 ms |
107316 KB |
Output is correct |
128 |
Correct |
1542 ms |
104292 KB |
Output is correct |
129 |
Correct |
1592 ms |
106292 KB |
Output is correct |
130 |
Correct |
1585 ms |
104188 KB |
Output is correct |
131 |
Correct |
1803 ms |
106160 KB |
Output is correct |
132 |
Correct |
1620 ms |
104056 KB |
Output is correct |
133 |
Correct |
17 ms |
20784 KB |
Output is correct |
134 |
Correct |
17 ms |
20800 KB |
Output is correct |
135 |
Correct |
18 ms |
20912 KB |
Output is correct |
136 |
Correct |
33 ms |
22404 KB |
Output is correct |
137 |
Correct |
99 ms |
26172 KB |
Output is correct |
138 |
Correct |
89 ms |
25884 KB |
Output is correct |
139 |
Correct |
72 ms |
26196 KB |
Output is correct |
140 |
Correct |
20 ms |
20948 KB |
Output is correct |
141 |
Correct |
76 ms |
25852 KB |
Output is correct |
142 |
Correct |
79 ms |
25804 KB |
Output is correct |
143 |
Correct |
85 ms |
25768 KB |
Output is correct |
144 |
Correct |
90 ms |
25932 KB |
Output is correct |
145 |
Correct |
65 ms |
26036 KB |
Output is correct |
146 |
Correct |
57 ms |
25848 KB |
Output is correct |
147 |
Correct |
74 ms |
25804 KB |
Output is correct |
148 |
Correct |
1586 ms |
103708 KB |
Output is correct |
149 |
Correct |
1535 ms |
107168 KB |
Output is correct |
150 |
Correct |
1454 ms |
102812 KB |
Output is correct |
151 |
Correct |
1182 ms |
105476 KB |
Output is correct |
152 |
Correct |
1617 ms |
102080 KB |
Output is correct |
153 |
Correct |
1525 ms |
102448 KB |
Output is correct |
154 |
Correct |
1621 ms |
108772 KB |
Output is correct |
155 |
Correct |
1709 ms |
122016 KB |
Output is correct |
156 |
Correct |
2001 ms |
137088 KB |
Output is correct |
157 |
Correct |
1572 ms |
122492 KB |
Output is correct |
158 |
Correct |
1193 ms |
99248 KB |
Output is correct |
159 |
Correct |
1578 ms |
125948 KB |
Output is correct |
160 |
Correct |
1401 ms |
114852 KB |
Output is correct |
161 |
Correct |
1837 ms |
103604 KB |
Output is correct |
162 |
Correct |
1802 ms |
101980 KB |
Output is correct |
163 |
Correct |
1904 ms |
102092 KB |
Output is correct |
164 |
Correct |
1631 ms |
106204 KB |
Output is correct |
165 |
Correct |
1568 ms |
102968 KB |
Output is correct |
166 |
Correct |
1448 ms |
102376 KB |
Output is correct |
167 |
Correct |
1680 ms |
102744 KB |
Output is correct |
168 |
Correct |
1426 ms |
102720 KB |
Output is correct |
169 |
Correct |
1565 ms |
103456 KB |
Output is correct |
170 |
Correct |
1549 ms |
107780 KB |
Output is correct |
171 |
Correct |
1609 ms |
107872 KB |
Output is correct |
172 |
Correct |
1739 ms |
105592 KB |
Output is correct |
173 |
Correct |
1531 ms |
103392 KB |
Output is correct |
174 |
Correct |
1769 ms |
105536 KB |
Output is correct |
175 |
Correct |
1661 ms |
108376 KB |
Output is correct |
176 |
Correct |
1538 ms |
104844 KB |
Output is correct |
177 |
Correct |
1554 ms |
107184 KB |
Output is correct |
178 |
Correct |
1503 ms |
104820 KB |
Output is correct |
179 |
Correct |
1694 ms |
107016 KB |
Output is correct |
180 |
Correct |
1531 ms |
104676 KB |
Output is correct |
181 |
Correct |
1846 ms |
107116 KB |
Output is correct |
182 |
Correct |
1710 ms |
111912 KB |
Output is correct |
183 |
Correct |
1941 ms |
125136 KB |
Output is correct |
184 |
Correct |
1652 ms |
125468 KB |
Output is correct |
185 |
Correct |
1430 ms |
117248 KB |
Output is correct |
186 |
Correct |
1592 ms |
105332 KB |
Output is correct |
187 |
Correct |
1352 ms |
100660 KB |
Output is correct |