#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 = 300;
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';
}
Compilation message
watchmen.cpp: In function 'll dij(int, int)':
watchmen.cpp:102:8: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
102 | auto [dard, md, v] = *Set.begin();
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
22348 KB |
Output is correct |
2 |
Correct |
121 ms |
26196 KB |
Output is correct |
3 |
Correct |
79 ms |
25828 KB |
Output is correct |
4 |
Correct |
78 ms |
26104 KB |
Output is correct |
5 |
Correct |
25 ms |
20964 KB |
Output is correct |
6 |
Correct |
76 ms |
25876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
22412 KB |
Output is correct |
2 |
Correct |
90 ms |
26148 KB |
Output is correct |
3 |
Correct |
78 ms |
25928 KB |
Output is correct |
4 |
Correct |
94 ms |
26084 KB |
Output is correct |
5 |
Correct |
24 ms |
20908 KB |
Output is correct |
6 |
Correct |
97 ms |
25992 KB |
Output is correct |
7 |
Correct |
112 ms |
25812 KB |
Output is correct |
8 |
Correct |
79 ms |
25800 KB |
Output is correct |
9 |
Correct |
91 ms |
25928 KB |
Output is correct |
10 |
Correct |
87 ms |
26076 KB |
Output is correct |
11 |
Correct |
78 ms |
25812 KB |
Output is correct |
12 |
Correct |
99 ms |
25812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
22412 KB |
Output is correct |
2 |
Correct |
90 ms |
26148 KB |
Output is correct |
3 |
Correct |
78 ms |
25928 KB |
Output is correct |
4 |
Correct |
94 ms |
26084 KB |
Output is correct |
5 |
Correct |
24 ms |
20908 KB |
Output is correct |
6 |
Correct |
97 ms |
25992 KB |
Output is correct |
7 |
Correct |
112 ms |
25812 KB |
Output is correct |
8 |
Correct |
79 ms |
25800 KB |
Output is correct |
9 |
Correct |
91 ms |
25928 KB |
Output is correct |
10 |
Correct |
87 ms |
26076 KB |
Output is correct |
11 |
Correct |
78 ms |
25812 KB |
Output is correct |
12 |
Correct |
99 ms |
25812 KB |
Output is correct |
13 |
Correct |
34 ms |
22400 KB |
Output is correct |
14 |
Correct |
114 ms |
26152 KB |
Output is correct |
15 |
Correct |
84 ms |
25808 KB |
Output is correct |
16 |
Correct |
74 ms |
26200 KB |
Output is correct |
17 |
Correct |
22 ms |
20912 KB |
Output is correct |
18 |
Correct |
94 ms |
25788 KB |
Output is correct |
19 |
Correct |
107 ms |
25784 KB |
Output is correct |
20 |
Correct |
97 ms |
25732 KB |
Output is correct |
21 |
Correct |
88 ms |
26012 KB |
Output is correct |
22 |
Correct |
62 ms |
26092 KB |
Output is correct |
23 |
Correct |
67 ms |
25912 KB |
Output is correct |
24 |
Correct |
96 ms |
25804 KB |
Output is correct |
25 |
Correct |
1612 ms |
104284 KB |
Output is correct |
26 |
Correct |
1745 ms |
108008 KB |
Output is correct |
27 |
Correct |
1505 ms |
103496 KB |
Output is correct |
28 |
Correct |
1250 ms |
106208 KB |
Output is correct |
29 |
Correct |
1534 ms |
102808 KB |
Output is correct |
30 |
Correct |
1448 ms |
103196 KB |
Output is correct |
31 |
Correct |
1578 ms |
109508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
22412 KB |
Output is correct |
2 |
Correct |
90 ms |
26148 KB |
Output is correct |
3 |
Correct |
78 ms |
25928 KB |
Output is correct |
4 |
Correct |
94 ms |
26084 KB |
Output is correct |
5 |
Correct |
24 ms |
20908 KB |
Output is correct |
6 |
Correct |
97 ms |
25992 KB |
Output is correct |
7 |
Correct |
112 ms |
25812 KB |
Output is correct |
8 |
Correct |
79 ms |
25800 KB |
Output is correct |
9 |
Correct |
91 ms |
25928 KB |
Output is correct |
10 |
Correct |
87 ms |
26076 KB |
Output is correct |
11 |
Correct |
78 ms |
25812 KB |
Output is correct |
12 |
Correct |
99 ms |
25812 KB |
Output is correct |
13 |
Correct |
34 ms |
22400 KB |
Output is correct |
14 |
Correct |
114 ms |
26152 KB |
Output is correct |
15 |
Correct |
84 ms |
25808 KB |
Output is correct |
16 |
Correct |
74 ms |
26200 KB |
Output is correct |
17 |
Correct |
22 ms |
20912 KB |
Output is correct |
18 |
Correct |
94 ms |
25788 KB |
Output is correct |
19 |
Correct |
107 ms |
25784 KB |
Output is correct |
20 |
Correct |
97 ms |
25732 KB |
Output is correct |
21 |
Correct |
88 ms |
26012 KB |
Output is correct |
22 |
Correct |
62 ms |
26092 KB |
Output is correct |
23 |
Correct |
67 ms |
25912 KB |
Output is correct |
24 |
Correct |
96 ms |
25804 KB |
Output is correct |
25 |
Correct |
1612 ms |
104284 KB |
Output is correct |
26 |
Correct |
1745 ms |
108008 KB |
Output is correct |
27 |
Correct |
1505 ms |
103496 KB |
Output is correct |
28 |
Correct |
1250 ms |
106208 KB |
Output is correct |
29 |
Correct |
1534 ms |
102808 KB |
Output is correct |
30 |
Correct |
1448 ms |
103196 KB |
Output is correct |
31 |
Correct |
1578 ms |
109508 KB |
Output is correct |
32 |
Correct |
33 ms |
22412 KB |
Output is correct |
33 |
Correct |
92 ms |
26168 KB |
Output is correct |
34 |
Correct |
87 ms |
25884 KB |
Output is correct |
35 |
Correct |
69 ms |
26112 KB |
Output is correct |
36 |
Correct |
18 ms |
21036 KB |
Output is correct |
37 |
Correct |
86 ms |
25800 KB |
Output is correct |
38 |
Correct |
104 ms |
25924 KB |
Output is correct |
39 |
Correct |
83 ms |
25956 KB |
Output is correct |
40 |
Correct |
89 ms |
26116 KB |
Output is correct |
41 |
Correct |
67 ms |
26024 KB |
Output is correct |
42 |
Correct |
75 ms |
25872 KB |
Output is correct |
43 |
Correct |
80 ms |
25836 KB |
Output is correct |
44 |
Correct |
1617 ms |
104316 KB |
Output is correct |
45 |
Correct |
1637 ms |
108104 KB |
Output is correct |
46 |
Correct |
1585 ms |
103344 KB |
Output is correct |
47 |
Correct |
1223 ms |
105732 KB |
Output is correct |
48 |
Correct |
1655 ms |
102320 KB |
Output is correct |
49 |
Correct |
1464 ms |
102700 KB |
Output is correct |
50 |
Correct |
1649 ms |
108964 KB |
Output is correct |
51 |
Correct |
1720 ms |
122248 KB |
Output is correct |
52 |
Correct |
2131 ms |
137420 KB |
Output is correct |
53 |
Correct |
1702 ms |
122628 KB |
Output is correct |
54 |
Correct |
1213 ms |
99372 KB |
Output is correct |
55 |
Correct |
1582 ms |
126344 KB |
Output is correct |
56 |
Correct |
1494 ms |
114832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
22348 KB |
Output is correct |
2 |
Correct |
121 ms |
26196 KB |
Output is correct |
3 |
Correct |
79 ms |
25828 KB |
Output is correct |
4 |
Correct |
78 ms |
26104 KB |
Output is correct |
5 |
Correct |
25 ms |
20964 KB |
Output is correct |
6 |
Correct |
76 ms |
25876 KB |
Output is correct |
7 |
Correct |
35 ms |
22412 KB |
Output is correct |
8 |
Correct |
90 ms |
26148 KB |
Output is correct |
9 |
Correct |
78 ms |
25928 KB |
Output is correct |
10 |
Correct |
94 ms |
26084 KB |
Output is correct |
11 |
Correct |
24 ms |
20908 KB |
Output is correct |
12 |
Correct |
97 ms |
25992 KB |
Output is correct |
13 |
Correct |
112 ms |
25812 KB |
Output is correct |
14 |
Correct |
79 ms |
25800 KB |
Output is correct |
15 |
Correct |
91 ms |
25928 KB |
Output is correct |
16 |
Correct |
87 ms |
26076 KB |
Output is correct |
17 |
Correct |
78 ms |
25812 KB |
Output is correct |
18 |
Correct |
99 ms |
25812 KB |
Output is correct |
19 |
Correct |
20 ms |
20812 KB |
Output is correct |
20 |
Correct |
16 ms |
20908 KB |
Output is correct |
21 |
Correct |
16 ms |
20792 KB |
Output is correct |
22 |
Correct |
34 ms |
22396 KB |
Output is correct |
23 |
Correct |
105 ms |
26204 KB |
Output is correct |
24 |
Correct |
85 ms |
25884 KB |
Output is correct |
25 |
Correct |
72 ms |
26200 KB |
Output is correct |
26 |
Correct |
20 ms |
20948 KB |
Output is correct |
27 |
Correct |
75 ms |
25808 KB |
Output is correct |
28 |
Correct |
90 ms |
25916 KB |
Output is correct |
29 |
Correct |
91 ms |
25828 KB |
Output is correct |
30 |
Correct |
136 ms |
25944 KB |
Output is correct |
31 |
Correct |
99 ms |
26104 KB |
Output is correct |
32 |
Correct |
80 ms |
25836 KB |
Output is correct |
33 |
Correct |
106 ms |
25812 KB |
Output is correct |
34 |
Correct |
1976 ms |
103700 KB |
Output is correct |
35 |
Correct |
1926 ms |
102192 KB |
Output is correct |
36 |
Correct |
1848 ms |
102052 KB |
Output is correct |
37 |
Correct |
1620 ms |
106580 KB |
Output is correct |
38 |
Correct |
1645 ms |
103080 KB |
Output is correct |
39 |
Correct |
1390 ms |
102536 KB |
Output is correct |
40 |
Correct |
1648 ms |
102632 KB |
Output is correct |
41 |
Correct |
1338 ms |
102988 KB |
Output is correct |
42 |
Correct |
1540 ms |
103220 KB |
Output is correct |
43 |
Correct |
1520 ms |
107676 KB |
Output is correct |
44 |
Correct |
1666 ms |
107772 KB |
Output is correct |
45 |
Correct |
1827 ms |
105272 KB |
Output is correct |
46 |
Correct |
1703 ms |
103080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
22348 KB |
Output is correct |
2 |
Correct |
121 ms |
26196 KB |
Output is correct |
3 |
Correct |
79 ms |
25828 KB |
Output is correct |
4 |
Correct |
78 ms |
26104 KB |
Output is correct |
5 |
Correct |
25 ms |
20964 KB |
Output is correct |
6 |
Correct |
76 ms |
25876 KB |
Output is correct |
7 |
Correct |
35 ms |
22412 KB |
Output is correct |
8 |
Correct |
90 ms |
26148 KB |
Output is correct |
9 |
Correct |
78 ms |
25928 KB |
Output is correct |
10 |
Correct |
94 ms |
26084 KB |
Output is correct |
11 |
Correct |
24 ms |
20908 KB |
Output is correct |
12 |
Correct |
97 ms |
25992 KB |
Output is correct |
13 |
Correct |
112 ms |
25812 KB |
Output is correct |
14 |
Correct |
79 ms |
25800 KB |
Output is correct |
15 |
Correct |
91 ms |
25928 KB |
Output is correct |
16 |
Correct |
87 ms |
26076 KB |
Output is correct |
17 |
Correct |
78 ms |
25812 KB |
Output is correct |
18 |
Correct |
99 ms |
25812 KB |
Output is correct |
19 |
Correct |
34 ms |
22400 KB |
Output is correct |
20 |
Correct |
114 ms |
26152 KB |
Output is correct |
21 |
Correct |
84 ms |
25808 KB |
Output is correct |
22 |
Correct |
74 ms |
26200 KB |
Output is correct |
23 |
Correct |
22 ms |
20912 KB |
Output is correct |
24 |
Correct |
94 ms |
25788 KB |
Output is correct |
25 |
Correct |
107 ms |
25784 KB |
Output is correct |
26 |
Correct |
97 ms |
25732 KB |
Output is correct |
27 |
Correct |
88 ms |
26012 KB |
Output is correct |
28 |
Correct |
62 ms |
26092 KB |
Output is correct |
29 |
Correct |
67 ms |
25912 KB |
Output is correct |
30 |
Correct |
96 ms |
25804 KB |
Output is correct |
31 |
Correct |
1612 ms |
104284 KB |
Output is correct |
32 |
Correct |
1745 ms |
108008 KB |
Output is correct |
33 |
Correct |
1505 ms |
103496 KB |
Output is correct |
34 |
Correct |
1250 ms |
106208 KB |
Output is correct |
35 |
Correct |
1534 ms |
102808 KB |
Output is correct |
36 |
Correct |
1448 ms |
103196 KB |
Output is correct |
37 |
Correct |
1578 ms |
109508 KB |
Output is correct |
38 |
Correct |
20 ms |
20812 KB |
Output is correct |
39 |
Correct |
16 ms |
20908 KB |
Output is correct |
40 |
Correct |
16 ms |
20792 KB |
Output is correct |
41 |
Correct |
34 ms |
22396 KB |
Output is correct |
42 |
Correct |
105 ms |
26204 KB |
Output is correct |
43 |
Correct |
85 ms |
25884 KB |
Output is correct |
44 |
Correct |
72 ms |
26200 KB |
Output is correct |
45 |
Correct |
20 ms |
20948 KB |
Output is correct |
46 |
Correct |
75 ms |
25808 KB |
Output is correct |
47 |
Correct |
90 ms |
25916 KB |
Output is correct |
48 |
Correct |
91 ms |
25828 KB |
Output is correct |
49 |
Correct |
136 ms |
25944 KB |
Output is correct |
50 |
Correct |
99 ms |
26104 KB |
Output is correct |
51 |
Correct |
80 ms |
25836 KB |
Output is correct |
52 |
Correct |
106 ms |
25812 KB |
Output is correct |
53 |
Correct |
1976 ms |
103700 KB |
Output is correct |
54 |
Correct |
1926 ms |
102192 KB |
Output is correct |
55 |
Correct |
1848 ms |
102052 KB |
Output is correct |
56 |
Correct |
1620 ms |
106580 KB |
Output is correct |
57 |
Correct |
1645 ms |
103080 KB |
Output is correct |
58 |
Correct |
1390 ms |
102536 KB |
Output is correct |
59 |
Correct |
1648 ms |
102632 KB |
Output is correct |
60 |
Correct |
1338 ms |
102988 KB |
Output is correct |
61 |
Correct |
1540 ms |
103220 KB |
Output is correct |
62 |
Correct |
1520 ms |
107676 KB |
Output is correct |
63 |
Correct |
1666 ms |
107772 KB |
Output is correct |
64 |
Correct |
1827 ms |
105272 KB |
Output is correct |
65 |
Correct |
1703 ms |
103080 KB |
Output is correct |
66 |
Correct |
16 ms |
20832 KB |
Output is correct |
67 |
Correct |
16 ms |
20796 KB |
Output is correct |
68 |
Correct |
17 ms |
20904 KB |
Output is correct |
69 |
Correct |
38 ms |
22400 KB |
Output is correct |
70 |
Correct |
94 ms |
26200 KB |
Output is correct |
71 |
Correct |
77 ms |
25916 KB |
Output is correct |
72 |
Correct |
82 ms |
26124 KB |
Output is correct |
73 |
Correct |
23 ms |
20948 KB |
Output is correct |
74 |
Correct |
77 ms |
25880 KB |
Output is correct |
75 |
Correct |
84 ms |
25812 KB |
Output is correct |
76 |
Correct |
81 ms |
25828 KB |
Output is correct |
77 |
Correct |
89 ms |
25920 KB |
Output is correct |
78 |
Correct |
84 ms |
26056 KB |
Output is correct |
79 |
Correct |
63 ms |
25864 KB |
Output is correct |
80 |
Correct |
85 ms |
25896 KB |
Output is correct |
81 |
Correct |
1670 ms |
103724 KB |
Output is correct |
82 |
Correct |
1617 ms |
107624 KB |
Output is correct |
83 |
Correct |
1618 ms |
102996 KB |
Output is correct |
84 |
Correct |
1251 ms |
105768 KB |
Output is correct |
85 |
Correct |
1646 ms |
102368 KB |
Output is correct |
86 |
Correct |
1488 ms |
102556 KB |
Output is correct |
87 |
Correct |
1583 ms |
108944 KB |
Output is correct |
88 |
Correct |
1837 ms |
103524 KB |
Output is correct |
89 |
Correct |
1965 ms |
101620 KB |
Output is correct |
90 |
Correct |
1864 ms |
101516 KB |
Output is correct |
91 |
Correct |
1702 ms |
105796 KB |
Output is correct |
92 |
Correct |
1702 ms |
102672 KB |
Output is correct |
93 |
Correct |
1794 ms |
101980 KB |
Output is correct |
94 |
Correct |
1828 ms |
102420 KB |
Output is correct |
95 |
Correct |
1520 ms |
102392 KB |
Output is correct |
96 |
Correct |
1738 ms |
102648 KB |
Output is correct |
97 |
Correct |
1632 ms |
106712 KB |
Output is correct |
98 |
Correct |
1728 ms |
106956 KB |
Output is correct |
99 |
Correct |
1845 ms |
104872 KB |
Output is correct |
100 |
Correct |
1563 ms |
102684 KB |
Output is correct |
101 |
Correct |
1887 ms |
104936 KB |
Output is correct |
102 |
Correct |
1772 ms |
108080 KB |
Output is correct |
103 |
Correct |
1694 ms |
104760 KB |
Output is correct |
104 |
Correct |
1609 ms |
107092 KB |
Output is correct |
105 |
Correct |
1637 ms |
104452 KB |
Output is correct |
106 |
Correct |
1757 ms |
106796 KB |
Output is correct |
107 |
Correct |
1684 ms |
104336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
22348 KB |
Output is correct |
2 |
Correct |
121 ms |
26196 KB |
Output is correct |
3 |
Correct |
79 ms |
25828 KB |
Output is correct |
4 |
Correct |
78 ms |
26104 KB |
Output is correct |
5 |
Correct |
25 ms |
20964 KB |
Output is correct |
6 |
Correct |
76 ms |
25876 KB |
Output is correct |
7 |
Correct |
35 ms |
22412 KB |
Output is correct |
8 |
Correct |
90 ms |
26148 KB |
Output is correct |
9 |
Correct |
78 ms |
25928 KB |
Output is correct |
10 |
Correct |
94 ms |
26084 KB |
Output is correct |
11 |
Correct |
24 ms |
20908 KB |
Output is correct |
12 |
Correct |
97 ms |
25992 KB |
Output is correct |
13 |
Correct |
112 ms |
25812 KB |
Output is correct |
14 |
Correct |
79 ms |
25800 KB |
Output is correct |
15 |
Correct |
91 ms |
25928 KB |
Output is correct |
16 |
Correct |
87 ms |
26076 KB |
Output is correct |
17 |
Correct |
78 ms |
25812 KB |
Output is correct |
18 |
Correct |
99 ms |
25812 KB |
Output is correct |
19 |
Correct |
34 ms |
22400 KB |
Output is correct |
20 |
Correct |
114 ms |
26152 KB |
Output is correct |
21 |
Correct |
84 ms |
25808 KB |
Output is correct |
22 |
Correct |
74 ms |
26200 KB |
Output is correct |
23 |
Correct |
22 ms |
20912 KB |
Output is correct |
24 |
Correct |
94 ms |
25788 KB |
Output is correct |
25 |
Correct |
107 ms |
25784 KB |
Output is correct |
26 |
Correct |
97 ms |
25732 KB |
Output is correct |
27 |
Correct |
88 ms |
26012 KB |
Output is correct |
28 |
Correct |
62 ms |
26092 KB |
Output is correct |
29 |
Correct |
67 ms |
25912 KB |
Output is correct |
30 |
Correct |
96 ms |
25804 KB |
Output is correct |
31 |
Correct |
1612 ms |
104284 KB |
Output is correct |
32 |
Correct |
1745 ms |
108008 KB |
Output is correct |
33 |
Correct |
1505 ms |
103496 KB |
Output is correct |
34 |
Correct |
1250 ms |
106208 KB |
Output is correct |
35 |
Correct |
1534 ms |
102808 KB |
Output is correct |
36 |
Correct |
1448 ms |
103196 KB |
Output is correct |
37 |
Correct |
1578 ms |
109508 KB |
Output is correct |
38 |
Correct |
33 ms |
22412 KB |
Output is correct |
39 |
Correct |
92 ms |
26168 KB |
Output is correct |
40 |
Correct |
87 ms |
25884 KB |
Output is correct |
41 |
Correct |
69 ms |
26112 KB |
Output is correct |
42 |
Correct |
18 ms |
21036 KB |
Output is correct |
43 |
Correct |
86 ms |
25800 KB |
Output is correct |
44 |
Correct |
104 ms |
25924 KB |
Output is correct |
45 |
Correct |
83 ms |
25956 KB |
Output is correct |
46 |
Correct |
89 ms |
26116 KB |
Output is correct |
47 |
Correct |
67 ms |
26024 KB |
Output is correct |
48 |
Correct |
75 ms |
25872 KB |
Output is correct |
49 |
Correct |
80 ms |
25836 KB |
Output is correct |
50 |
Correct |
1617 ms |
104316 KB |
Output is correct |
51 |
Correct |
1637 ms |
108104 KB |
Output is correct |
52 |
Correct |
1585 ms |
103344 KB |
Output is correct |
53 |
Correct |
1223 ms |
105732 KB |
Output is correct |
54 |
Correct |
1655 ms |
102320 KB |
Output is correct |
55 |
Correct |
1464 ms |
102700 KB |
Output is correct |
56 |
Correct |
1649 ms |
108964 KB |
Output is correct |
57 |
Correct |
1720 ms |
122248 KB |
Output is correct |
58 |
Correct |
2131 ms |
137420 KB |
Output is correct |
59 |
Correct |
1702 ms |
122628 KB |
Output is correct |
60 |
Correct |
1213 ms |
99372 KB |
Output is correct |
61 |
Correct |
1582 ms |
126344 KB |
Output is correct |
62 |
Correct |
1494 ms |
114832 KB |
Output is correct |
63 |
Correct |
20 ms |
20812 KB |
Output is correct |
64 |
Correct |
16 ms |
20908 KB |
Output is correct |
65 |
Correct |
16 ms |
20792 KB |
Output is correct |
66 |
Correct |
34 ms |
22396 KB |
Output is correct |
67 |
Correct |
105 ms |
26204 KB |
Output is correct |
68 |
Correct |
85 ms |
25884 KB |
Output is correct |
69 |
Correct |
72 ms |
26200 KB |
Output is correct |
70 |
Correct |
20 ms |
20948 KB |
Output is correct |
71 |
Correct |
75 ms |
25808 KB |
Output is correct |
72 |
Correct |
90 ms |
25916 KB |
Output is correct |
73 |
Correct |
91 ms |
25828 KB |
Output is correct |
74 |
Correct |
136 ms |
25944 KB |
Output is correct |
75 |
Correct |
99 ms |
26104 KB |
Output is correct |
76 |
Correct |
80 ms |
25836 KB |
Output is correct |
77 |
Correct |
106 ms |
25812 KB |
Output is correct |
78 |
Correct |
1976 ms |
103700 KB |
Output is correct |
79 |
Correct |
1926 ms |
102192 KB |
Output is correct |
80 |
Correct |
1848 ms |
102052 KB |
Output is correct |
81 |
Correct |
1620 ms |
106580 KB |
Output is correct |
82 |
Correct |
1645 ms |
103080 KB |
Output is correct |
83 |
Correct |
1390 ms |
102536 KB |
Output is correct |
84 |
Correct |
1648 ms |
102632 KB |
Output is correct |
85 |
Correct |
1338 ms |
102988 KB |
Output is correct |
86 |
Correct |
1540 ms |
103220 KB |
Output is correct |
87 |
Correct |
1520 ms |
107676 KB |
Output is correct |
88 |
Correct |
1666 ms |
107772 KB |
Output is correct |
89 |
Correct |
1827 ms |
105272 KB |
Output is correct |
90 |
Correct |
1703 ms |
103080 KB |
Output is correct |
91 |
Correct |
16 ms |
20832 KB |
Output is correct |
92 |
Correct |
16 ms |
20796 KB |
Output is correct |
93 |
Correct |
17 ms |
20904 KB |
Output is correct |
94 |
Correct |
38 ms |
22400 KB |
Output is correct |
95 |
Correct |
94 ms |
26200 KB |
Output is correct |
96 |
Correct |
77 ms |
25916 KB |
Output is correct |
97 |
Correct |
82 ms |
26124 KB |
Output is correct |
98 |
Correct |
23 ms |
20948 KB |
Output is correct |
99 |
Correct |
77 ms |
25880 KB |
Output is correct |
100 |
Correct |
84 ms |
25812 KB |
Output is correct |
101 |
Correct |
81 ms |
25828 KB |
Output is correct |
102 |
Correct |
89 ms |
25920 KB |
Output is correct |
103 |
Correct |
84 ms |
26056 KB |
Output is correct |
104 |
Correct |
63 ms |
25864 KB |
Output is correct |
105 |
Correct |
85 ms |
25896 KB |
Output is correct |
106 |
Correct |
1670 ms |
103724 KB |
Output is correct |
107 |
Correct |
1617 ms |
107624 KB |
Output is correct |
108 |
Correct |
1618 ms |
102996 KB |
Output is correct |
109 |
Correct |
1251 ms |
105768 KB |
Output is correct |
110 |
Correct |
1646 ms |
102368 KB |
Output is correct |
111 |
Correct |
1488 ms |
102556 KB |
Output is correct |
112 |
Correct |
1583 ms |
108944 KB |
Output is correct |
113 |
Correct |
1837 ms |
103524 KB |
Output is correct |
114 |
Correct |
1965 ms |
101620 KB |
Output is correct |
115 |
Correct |
1864 ms |
101516 KB |
Output is correct |
116 |
Correct |
1702 ms |
105796 KB |
Output is correct |
117 |
Correct |
1702 ms |
102672 KB |
Output is correct |
118 |
Correct |
1794 ms |
101980 KB |
Output is correct |
119 |
Correct |
1828 ms |
102420 KB |
Output is correct |
120 |
Correct |
1520 ms |
102392 KB |
Output is correct |
121 |
Correct |
1738 ms |
102648 KB |
Output is correct |
122 |
Correct |
1632 ms |
106712 KB |
Output is correct |
123 |
Correct |
1728 ms |
106956 KB |
Output is correct |
124 |
Correct |
1845 ms |
104872 KB |
Output is correct |
125 |
Correct |
1563 ms |
102684 KB |
Output is correct |
126 |
Correct |
1887 ms |
104936 KB |
Output is correct |
127 |
Correct |
1772 ms |
108080 KB |
Output is correct |
128 |
Correct |
1694 ms |
104760 KB |
Output is correct |
129 |
Correct |
1609 ms |
107092 KB |
Output is correct |
130 |
Correct |
1637 ms |
104452 KB |
Output is correct |
131 |
Correct |
1757 ms |
106796 KB |
Output is correct |
132 |
Correct |
1684 ms |
104336 KB |
Output is correct |
133 |
Correct |
16 ms |
20820 KB |
Output is correct |
134 |
Correct |
16 ms |
20848 KB |
Output is correct |
135 |
Correct |
17 ms |
20908 KB |
Output is correct |
136 |
Correct |
33 ms |
22472 KB |
Output is correct |
137 |
Correct |
111 ms |
26204 KB |
Output is correct |
138 |
Correct |
81 ms |
25812 KB |
Output is correct |
139 |
Correct |
97 ms |
26108 KB |
Output is correct |
140 |
Correct |
20 ms |
20948 KB |
Output is correct |
141 |
Correct |
94 ms |
25820 KB |
Output is correct |
142 |
Correct |
83 ms |
25776 KB |
Output is correct |
143 |
Correct |
96 ms |
25756 KB |
Output is correct |
144 |
Correct |
102 ms |
25912 KB |
Output is correct |
145 |
Correct |
67 ms |
26044 KB |
Output is correct |
146 |
Correct |
65 ms |
25828 KB |
Output is correct |
147 |
Correct |
90 ms |
25812 KB |
Output is correct |
148 |
Correct |
1742 ms |
103832 KB |
Output is correct |
149 |
Correct |
1691 ms |
107392 KB |
Output is correct |
150 |
Correct |
1603 ms |
102872 KB |
Output is correct |
151 |
Correct |
1378 ms |
105592 KB |
Output is correct |
152 |
Correct |
1663 ms |
102344 KB |
Output is correct |
153 |
Correct |
1474 ms |
102624 KB |
Output is correct |
154 |
Correct |
1714 ms |
108968 KB |
Output is correct |
155 |
Correct |
1734 ms |
121832 KB |
Output is correct |
156 |
Correct |
2202 ms |
137296 KB |
Output is correct |
157 |
Correct |
1606 ms |
122452 KB |
Output is correct |
158 |
Correct |
1291 ms |
99252 KB |
Output is correct |
159 |
Correct |
1803 ms |
125960 KB |
Output is correct |
160 |
Correct |
1489 ms |
114652 KB |
Output is correct |
161 |
Correct |
1957 ms |
103464 KB |
Output is correct |
162 |
Correct |
1920 ms |
101932 KB |
Output is correct |
163 |
Correct |
1984 ms |
101992 KB |
Output is correct |
164 |
Correct |
1663 ms |
106136 KB |
Output is correct |
165 |
Correct |
1713 ms |
102976 KB |
Output is correct |
166 |
Correct |
1459 ms |
102788 KB |
Output is correct |
167 |
Correct |
1669 ms |
103140 KB |
Output is correct |
168 |
Correct |
1528 ms |
102832 KB |
Output is correct |
169 |
Correct |
1715 ms |
103112 KB |
Output is correct |
170 |
Correct |
1678 ms |
107268 KB |
Output is correct |
171 |
Correct |
1700 ms |
107440 KB |
Output is correct |
172 |
Correct |
1843 ms |
105236 KB |
Output is correct |
173 |
Correct |
1615 ms |
103000 KB |
Output is correct |
174 |
Correct |
1827 ms |
105168 KB |
Output is correct |
175 |
Correct |
1748 ms |
107776 KB |
Output is correct |
176 |
Correct |
1621 ms |
104468 KB |
Output is correct |
177 |
Correct |
1671 ms |
106588 KB |
Output is correct |
178 |
Correct |
1671 ms |
104264 KB |
Output is correct |
179 |
Correct |
1830 ms |
106428 KB |
Output is correct |
180 |
Correct |
1616 ms |
104264 KB |
Output is correct |
181 |
Correct |
2085 ms |
106656 KB |
Output is correct |
182 |
Correct |
1689 ms |
111124 KB |
Output is correct |
183 |
Correct |
2070 ms |
124080 KB |
Output is correct |
184 |
Correct |
1751 ms |
124836 KB |
Output is correct |
185 |
Correct |
1522 ms |
116640 KB |
Output is correct |
186 |
Correct |
1583 ms |
105064 KB |
Output is correct |
187 |
Correct |
1465 ms |
100352 KB |
Output is correct |