#include <bits/stdc++.h>
using namespace std;
#define INF 998244353
int cylen[1000];
int cycno[300100];
int cypos[300100];
vector<int>link[300100];
vector<int>dp[300100];
vector<bool>vis[300100];
priority_queue<pair<int, pair<int, int>>>x;
void upd(pair<int, int> pos)
{
int o = pos.second % cylen[cycno[pos.first]];
if ((cylen[cycno[pos.first]] == 1 || o != cypos[pos.first]) && pos.second < dp[pos.first][o])
{
dp[pos.first][o] = pos.second;
x.push({ {-pos.second},{pos.first,o} });
}
}
int getne(int cur, int nem, int mb)
{
return cur + (nem + mb - cur % mb) % mb;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, M, K;
cin >> N >> M;
int i;
for (i = 0; i < M; i++)
{
int a, b;
cin >> a >> b;
link[a].push_back(b);
link[b].push_back(a);
}
cin >> K;
cylen[0] = 1;
for (i = 1; i <= K; i++)
{
cin >> cylen[i];
int j;
for (j = 0; j < cylen[i]; j++)
{
int a;
cin >> a;
cycno[a] = i;
cypos[a] = j;
}
}
for (i = 1; i <= N; i++)
{
if (!cycno[i])
{
dp[i].resize(1, INF);
}
else
{
dp[i].resize(cylen[cycno[i]], INF);
}
vis[i].resize(dp[i].size());
}
upd({ 1,0 });
while (x.size())
{
auto cu = x.top();
x.pop();
int t = -cu.first;
int curp = cu.second.first;
int curr = cu.second.second;
if (t!=dp[curp][curr])
{
continue;
}
for (i = 0; i < link[curp].size(); i++)
{
int nexp = link[curp][i];
int pa = cycno[curp];
int pb = cycno[nexp];
if (!pa || pa != pb || (cypos[nexp] + 1) % cylen[pa] != cypos[curp] || cypos[nexp] != curr)
{
upd({ nexp,t + 1 });
}
if (!pa && pb)
{
upd({ nexp,t + 1 + (cypos[nexp] + cylen[pb] - t % cylen[pb]) % cylen[pb] });
}
int re = 0;
if (pa && pb && (pa != pb || (cypos[curp] + 1) % cylen[pa] != cypos[nexp] && (cypos[nexp] + 1) % cylen[pb] != cypos[curp]))
{
int jw = getne(t, cypos[nexp], cylen[pb]);
int jjw = getne(jw, cypos[curp], cylen[pa]);
if (jw != jjw)
{
upd({ nexp,jw + 1 });
re = 1;
}
else
{
int bo = jw+(curr+cylen[pa]-cypos[curp])%cylen[pa];
upd({ nexp,bo + 1 });
if (cylen[pb] % cylen[pa] && (cylen[pa] % cylen[pb] || (cypos[curp] + cylen[pa] - curr) % cylen[pa] >= cylen[pb]))
{
upd({ nexp,bo + 1 + (cypos[nexp] + cylen[pb] - bo % cylen[pb]) % cylen[pb] });
}
}
}
if (!pa || !pb || re)
{
swap(link[curp][i], link[curp].back());
link[curp].pop_back();
i--;
}
}
upd({ curp, t + 1 });
}
if (dp[N][0] == 998244353)
{
cout << "impossible";
}
else
{
cout << dp[N][0];
}
}
Compilation message
watchmen.cpp: In function 'int main()':
watchmen.cpp:76:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
76 | for (i = 0; i < link[curp].size(); i++)
| ~~^~~~~~~~~~~~~~~~~~~
watchmen.cpp:90:78: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
90 | if (pa && pb && (pa != pb || (cypos[curp] + 1) % cylen[pa] != cypos[nexp] && (cypos[nexp] + 1) % cylen[pb] != cypos[curp]))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27604 KB |
Output is correct |
2 |
Correct |
97 ms |
37196 KB |
Output is correct |
3 |
Correct |
91 ms |
36532 KB |
Output is correct |
4 |
Correct |
118 ms |
36796 KB |
Output is correct |
5 |
Correct |
16 ms |
26136 KB |
Output is correct |
6 |
Correct |
124 ms |
36420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27700 KB |
Output is correct |
2 |
Correct |
97 ms |
37288 KB |
Output is correct |
3 |
Correct |
115 ms |
36580 KB |
Output is correct |
4 |
Correct |
105 ms |
36612 KB |
Output is correct |
5 |
Correct |
17 ms |
26228 KB |
Output is correct |
6 |
Correct |
87 ms |
36420 KB |
Output is correct |
7 |
Correct |
83 ms |
36452 KB |
Output is correct |
8 |
Correct |
85 ms |
36428 KB |
Output is correct |
9 |
Correct |
119 ms |
36476 KB |
Output is correct |
10 |
Correct |
105 ms |
36600 KB |
Output is correct |
11 |
Correct |
83 ms |
36564 KB |
Output is correct |
12 |
Correct |
88 ms |
36472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27700 KB |
Output is correct |
2 |
Correct |
97 ms |
37288 KB |
Output is correct |
3 |
Correct |
115 ms |
36580 KB |
Output is correct |
4 |
Correct |
105 ms |
36612 KB |
Output is correct |
5 |
Correct |
17 ms |
26228 KB |
Output is correct |
6 |
Correct |
87 ms |
36420 KB |
Output is correct |
7 |
Correct |
83 ms |
36452 KB |
Output is correct |
8 |
Correct |
85 ms |
36428 KB |
Output is correct |
9 |
Correct |
119 ms |
36476 KB |
Output is correct |
10 |
Correct |
105 ms |
36600 KB |
Output is correct |
11 |
Correct |
83 ms |
36564 KB |
Output is correct |
12 |
Correct |
88 ms |
36472 KB |
Output is correct |
13 |
Correct |
31 ms |
27712 KB |
Output is correct |
14 |
Correct |
117 ms |
37284 KB |
Output is correct |
15 |
Correct |
95 ms |
36536 KB |
Output is correct |
16 |
Correct |
88 ms |
36556 KB |
Output is correct |
17 |
Correct |
17 ms |
26256 KB |
Output is correct |
18 |
Correct |
91 ms |
36416 KB |
Output is correct |
19 |
Correct |
107 ms |
36416 KB |
Output is correct |
20 |
Correct |
95 ms |
36428 KB |
Output is correct |
21 |
Correct |
82 ms |
36416 KB |
Output is correct |
22 |
Correct |
93 ms |
36632 KB |
Output is correct |
23 |
Correct |
124 ms |
36532 KB |
Output is correct |
24 |
Correct |
109 ms |
36556 KB |
Output is correct |
25 |
Correct |
1888 ms |
97716 KB |
Output is correct |
26 |
Correct |
1782 ms |
102484 KB |
Output is correct |
27 |
Correct |
1632 ms |
97960 KB |
Output is correct |
28 |
Correct |
1164 ms |
102064 KB |
Output is correct |
29 |
Correct |
1597 ms |
93252 KB |
Output is correct |
30 |
Correct |
1655 ms |
95936 KB |
Output is correct |
31 |
Correct |
2127 ms |
102232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27700 KB |
Output is correct |
2 |
Correct |
97 ms |
37288 KB |
Output is correct |
3 |
Correct |
115 ms |
36580 KB |
Output is correct |
4 |
Correct |
105 ms |
36612 KB |
Output is correct |
5 |
Correct |
17 ms |
26228 KB |
Output is correct |
6 |
Correct |
87 ms |
36420 KB |
Output is correct |
7 |
Correct |
83 ms |
36452 KB |
Output is correct |
8 |
Correct |
85 ms |
36428 KB |
Output is correct |
9 |
Correct |
119 ms |
36476 KB |
Output is correct |
10 |
Correct |
105 ms |
36600 KB |
Output is correct |
11 |
Correct |
83 ms |
36564 KB |
Output is correct |
12 |
Correct |
88 ms |
36472 KB |
Output is correct |
13 |
Correct |
31 ms |
27712 KB |
Output is correct |
14 |
Correct |
117 ms |
37284 KB |
Output is correct |
15 |
Correct |
95 ms |
36536 KB |
Output is correct |
16 |
Correct |
88 ms |
36556 KB |
Output is correct |
17 |
Correct |
17 ms |
26256 KB |
Output is correct |
18 |
Correct |
91 ms |
36416 KB |
Output is correct |
19 |
Correct |
107 ms |
36416 KB |
Output is correct |
20 |
Correct |
95 ms |
36428 KB |
Output is correct |
21 |
Correct |
82 ms |
36416 KB |
Output is correct |
22 |
Correct |
93 ms |
36632 KB |
Output is correct |
23 |
Correct |
124 ms |
36532 KB |
Output is correct |
24 |
Correct |
109 ms |
36556 KB |
Output is correct |
25 |
Correct |
1888 ms |
97716 KB |
Output is correct |
26 |
Correct |
1782 ms |
102484 KB |
Output is correct |
27 |
Correct |
1632 ms |
97960 KB |
Output is correct |
28 |
Correct |
1164 ms |
102064 KB |
Output is correct |
29 |
Correct |
1597 ms |
93252 KB |
Output is correct |
30 |
Correct |
1655 ms |
95936 KB |
Output is correct |
31 |
Correct |
2127 ms |
102232 KB |
Output is correct |
32 |
Correct |
31 ms |
27712 KB |
Output is correct |
33 |
Correct |
133 ms |
37260 KB |
Output is correct |
34 |
Correct |
94 ms |
36548 KB |
Output is correct |
35 |
Correct |
96 ms |
36684 KB |
Output is correct |
36 |
Correct |
17 ms |
26172 KB |
Output is correct |
37 |
Correct |
99 ms |
36488 KB |
Output is correct |
38 |
Correct |
86 ms |
36428 KB |
Output is correct |
39 |
Correct |
94 ms |
36376 KB |
Output is correct |
40 |
Correct |
93 ms |
36376 KB |
Output is correct |
41 |
Correct |
93 ms |
36664 KB |
Output is correct |
42 |
Correct |
101 ms |
36508 KB |
Output is correct |
43 |
Correct |
98 ms |
36484 KB |
Output is correct |
44 |
Correct |
1874 ms |
97912 KB |
Output is correct |
45 |
Correct |
1861 ms |
102288 KB |
Output is correct |
46 |
Correct |
1644 ms |
98152 KB |
Output is correct |
47 |
Correct |
1274 ms |
101920 KB |
Output is correct |
48 |
Correct |
1679 ms |
93100 KB |
Output is correct |
49 |
Correct |
1663 ms |
95700 KB |
Output is correct |
50 |
Correct |
2020 ms |
101400 KB |
Output is correct |
51 |
Correct |
2591 ms |
105984 KB |
Output is correct |
52 |
Correct |
2892 ms |
116248 KB |
Output is correct |
53 |
Correct |
2336 ms |
105528 KB |
Output is correct |
54 |
Correct |
1219 ms |
91372 KB |
Output is correct |
55 |
Correct |
2431 ms |
105584 KB |
Output is correct |
56 |
Correct |
2250 ms |
97684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27604 KB |
Output is correct |
2 |
Correct |
97 ms |
37196 KB |
Output is correct |
3 |
Correct |
91 ms |
36532 KB |
Output is correct |
4 |
Correct |
118 ms |
36796 KB |
Output is correct |
5 |
Correct |
16 ms |
26136 KB |
Output is correct |
6 |
Correct |
124 ms |
36420 KB |
Output is correct |
7 |
Correct |
31 ms |
27700 KB |
Output is correct |
8 |
Correct |
97 ms |
37288 KB |
Output is correct |
9 |
Correct |
115 ms |
36580 KB |
Output is correct |
10 |
Correct |
105 ms |
36612 KB |
Output is correct |
11 |
Correct |
17 ms |
26228 KB |
Output is correct |
12 |
Correct |
87 ms |
36420 KB |
Output is correct |
13 |
Correct |
83 ms |
36452 KB |
Output is correct |
14 |
Correct |
85 ms |
36428 KB |
Output is correct |
15 |
Correct |
119 ms |
36476 KB |
Output is correct |
16 |
Correct |
105 ms |
36600 KB |
Output is correct |
17 |
Correct |
83 ms |
36564 KB |
Output is correct |
18 |
Correct |
88 ms |
36472 KB |
Output is correct |
19 |
Correct |
14 ms |
26072 KB |
Output is correct |
20 |
Correct |
15 ms |
26068 KB |
Output is correct |
21 |
Correct |
15 ms |
26292 KB |
Output is correct |
22 |
Correct |
30 ms |
27660 KB |
Output is correct |
23 |
Correct |
116 ms |
37168 KB |
Output is correct |
24 |
Correct |
123 ms |
36540 KB |
Output is correct |
25 |
Correct |
96 ms |
36664 KB |
Output is correct |
26 |
Correct |
17 ms |
26236 KB |
Output is correct |
27 |
Correct |
86 ms |
36428 KB |
Output is correct |
28 |
Correct |
114 ms |
36388 KB |
Output is correct |
29 |
Correct |
96 ms |
36464 KB |
Output is correct |
30 |
Correct |
90 ms |
36392 KB |
Output is correct |
31 |
Correct |
88 ms |
36632 KB |
Output is correct |
32 |
Correct |
87 ms |
36556 KB |
Output is correct |
33 |
Correct |
103 ms |
36428 KB |
Output is correct |
34 |
Correct |
1823 ms |
95068 KB |
Output is correct |
35 |
Correct |
1929 ms |
91180 KB |
Output is correct |
36 |
Correct |
1943 ms |
90988 KB |
Output is correct |
37 |
Correct |
1634 ms |
95992 KB |
Output is correct |
38 |
Correct |
1835 ms |
93188 KB |
Output is correct |
39 |
Correct |
1603 ms |
89084 KB |
Output is correct |
40 |
Correct |
1589 ms |
89224 KB |
Output is correct |
41 |
Correct |
1615 ms |
88732 KB |
Output is correct |
42 |
Correct |
1849 ms |
91788 KB |
Output is correct |
43 |
Correct |
1865 ms |
94632 KB |
Output is correct |
44 |
Correct |
1841 ms |
93424 KB |
Output is correct |
45 |
Correct |
1924 ms |
88140 KB |
Output is correct |
46 |
Correct |
1897 ms |
121144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27604 KB |
Output is correct |
2 |
Correct |
97 ms |
37196 KB |
Output is correct |
3 |
Correct |
91 ms |
36532 KB |
Output is correct |
4 |
Correct |
118 ms |
36796 KB |
Output is correct |
5 |
Correct |
16 ms |
26136 KB |
Output is correct |
6 |
Correct |
124 ms |
36420 KB |
Output is correct |
7 |
Correct |
31 ms |
27700 KB |
Output is correct |
8 |
Correct |
97 ms |
37288 KB |
Output is correct |
9 |
Correct |
115 ms |
36580 KB |
Output is correct |
10 |
Correct |
105 ms |
36612 KB |
Output is correct |
11 |
Correct |
17 ms |
26228 KB |
Output is correct |
12 |
Correct |
87 ms |
36420 KB |
Output is correct |
13 |
Correct |
83 ms |
36452 KB |
Output is correct |
14 |
Correct |
85 ms |
36428 KB |
Output is correct |
15 |
Correct |
119 ms |
36476 KB |
Output is correct |
16 |
Correct |
105 ms |
36600 KB |
Output is correct |
17 |
Correct |
83 ms |
36564 KB |
Output is correct |
18 |
Correct |
88 ms |
36472 KB |
Output is correct |
19 |
Correct |
31 ms |
27712 KB |
Output is correct |
20 |
Correct |
117 ms |
37284 KB |
Output is correct |
21 |
Correct |
95 ms |
36536 KB |
Output is correct |
22 |
Correct |
88 ms |
36556 KB |
Output is correct |
23 |
Correct |
17 ms |
26256 KB |
Output is correct |
24 |
Correct |
91 ms |
36416 KB |
Output is correct |
25 |
Correct |
107 ms |
36416 KB |
Output is correct |
26 |
Correct |
95 ms |
36428 KB |
Output is correct |
27 |
Correct |
82 ms |
36416 KB |
Output is correct |
28 |
Correct |
93 ms |
36632 KB |
Output is correct |
29 |
Correct |
124 ms |
36532 KB |
Output is correct |
30 |
Correct |
109 ms |
36556 KB |
Output is correct |
31 |
Correct |
1888 ms |
97716 KB |
Output is correct |
32 |
Correct |
1782 ms |
102484 KB |
Output is correct |
33 |
Correct |
1632 ms |
97960 KB |
Output is correct |
34 |
Correct |
1164 ms |
102064 KB |
Output is correct |
35 |
Correct |
1597 ms |
93252 KB |
Output is correct |
36 |
Correct |
1655 ms |
95936 KB |
Output is correct |
37 |
Correct |
2127 ms |
102232 KB |
Output is correct |
38 |
Correct |
14 ms |
26072 KB |
Output is correct |
39 |
Correct |
15 ms |
26068 KB |
Output is correct |
40 |
Correct |
15 ms |
26292 KB |
Output is correct |
41 |
Correct |
30 ms |
27660 KB |
Output is correct |
42 |
Correct |
116 ms |
37168 KB |
Output is correct |
43 |
Correct |
123 ms |
36540 KB |
Output is correct |
44 |
Correct |
96 ms |
36664 KB |
Output is correct |
45 |
Correct |
17 ms |
26236 KB |
Output is correct |
46 |
Correct |
86 ms |
36428 KB |
Output is correct |
47 |
Correct |
114 ms |
36388 KB |
Output is correct |
48 |
Correct |
96 ms |
36464 KB |
Output is correct |
49 |
Correct |
90 ms |
36392 KB |
Output is correct |
50 |
Correct |
88 ms |
36632 KB |
Output is correct |
51 |
Correct |
87 ms |
36556 KB |
Output is correct |
52 |
Correct |
103 ms |
36428 KB |
Output is correct |
53 |
Correct |
1823 ms |
95068 KB |
Output is correct |
54 |
Correct |
1929 ms |
91180 KB |
Output is correct |
55 |
Correct |
1943 ms |
90988 KB |
Output is correct |
56 |
Correct |
1634 ms |
95992 KB |
Output is correct |
57 |
Correct |
1835 ms |
93188 KB |
Output is correct |
58 |
Correct |
1603 ms |
89084 KB |
Output is correct |
59 |
Correct |
1589 ms |
89224 KB |
Output is correct |
60 |
Correct |
1615 ms |
88732 KB |
Output is correct |
61 |
Correct |
1849 ms |
91788 KB |
Output is correct |
62 |
Correct |
1865 ms |
94632 KB |
Output is correct |
63 |
Correct |
1841 ms |
93424 KB |
Output is correct |
64 |
Correct |
1924 ms |
88140 KB |
Output is correct |
65 |
Correct |
1897 ms |
121144 KB |
Output is correct |
66 |
Correct |
15 ms |
26164 KB |
Output is correct |
67 |
Correct |
15 ms |
26068 KB |
Output is correct |
68 |
Correct |
15 ms |
26136 KB |
Output is correct |
69 |
Correct |
35 ms |
27716 KB |
Output is correct |
70 |
Correct |
107 ms |
37212 KB |
Output is correct |
71 |
Correct |
91 ms |
36556 KB |
Output is correct |
72 |
Correct |
90 ms |
36668 KB |
Output is correct |
73 |
Correct |
16 ms |
26196 KB |
Output is correct |
74 |
Correct |
87 ms |
36472 KB |
Output is correct |
75 |
Correct |
89 ms |
36556 KB |
Output is correct |
76 |
Correct |
94 ms |
36460 KB |
Output is correct |
77 |
Correct |
82 ms |
36400 KB |
Output is correct |
78 |
Correct |
88 ms |
36648 KB |
Output is correct |
79 |
Correct |
84 ms |
36568 KB |
Output is correct |
80 |
Correct |
87 ms |
36456 KB |
Output is correct |
81 |
Correct |
1832 ms |
121408 KB |
Output is correct |
82 |
Correct |
1673 ms |
125828 KB |
Output is correct |
83 |
Correct |
1586 ms |
121508 KB |
Output is correct |
84 |
Correct |
1255 ms |
125156 KB |
Output is correct |
85 |
Correct |
1622 ms |
117020 KB |
Output is correct |
86 |
Correct |
1675 ms |
119020 KB |
Output is correct |
87 |
Correct |
1906 ms |
125736 KB |
Output is correct |
88 |
Correct |
1827 ms |
121080 KB |
Output is correct |
89 |
Correct |
1925 ms |
117892 KB |
Output is correct |
90 |
Correct |
1951 ms |
117804 KB |
Output is correct |
91 |
Correct |
1685 ms |
122896 KB |
Output is correct |
92 |
Correct |
1804 ms |
120280 KB |
Output is correct |
93 |
Correct |
1564 ms |
117152 KB |
Output is correct |
94 |
Correct |
1623 ms |
117040 KB |
Output is correct |
95 |
Correct |
1655 ms |
116940 KB |
Output is correct |
96 |
Correct |
1841 ms |
120864 KB |
Output is correct |
97 |
Correct |
1870 ms |
124060 KB |
Output is correct |
98 |
Correct |
1865 ms |
124876 KB |
Output is correct |
99 |
Correct |
1937 ms |
119896 KB |
Output is correct |
100 |
Correct |
1807 ms |
119344 KB |
Output is correct |
101 |
Correct |
1783 ms |
122936 KB |
Output is correct |
102 |
Correct |
1767 ms |
123868 KB |
Output is correct |
103 |
Correct |
1815 ms |
121112 KB |
Output is correct |
104 |
Correct |
1644 ms |
119796 KB |
Output is correct |
105 |
Correct |
1799 ms |
121956 KB |
Output is correct |
106 |
Correct |
1953 ms |
121336 KB |
Output is correct |
107 |
Correct |
1838 ms |
121284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
27604 KB |
Output is correct |
2 |
Correct |
97 ms |
37196 KB |
Output is correct |
3 |
Correct |
91 ms |
36532 KB |
Output is correct |
4 |
Correct |
118 ms |
36796 KB |
Output is correct |
5 |
Correct |
16 ms |
26136 KB |
Output is correct |
6 |
Correct |
124 ms |
36420 KB |
Output is correct |
7 |
Correct |
31 ms |
27700 KB |
Output is correct |
8 |
Correct |
97 ms |
37288 KB |
Output is correct |
9 |
Correct |
115 ms |
36580 KB |
Output is correct |
10 |
Correct |
105 ms |
36612 KB |
Output is correct |
11 |
Correct |
17 ms |
26228 KB |
Output is correct |
12 |
Correct |
87 ms |
36420 KB |
Output is correct |
13 |
Correct |
83 ms |
36452 KB |
Output is correct |
14 |
Correct |
85 ms |
36428 KB |
Output is correct |
15 |
Correct |
119 ms |
36476 KB |
Output is correct |
16 |
Correct |
105 ms |
36600 KB |
Output is correct |
17 |
Correct |
83 ms |
36564 KB |
Output is correct |
18 |
Correct |
88 ms |
36472 KB |
Output is correct |
19 |
Correct |
31 ms |
27712 KB |
Output is correct |
20 |
Correct |
117 ms |
37284 KB |
Output is correct |
21 |
Correct |
95 ms |
36536 KB |
Output is correct |
22 |
Correct |
88 ms |
36556 KB |
Output is correct |
23 |
Correct |
17 ms |
26256 KB |
Output is correct |
24 |
Correct |
91 ms |
36416 KB |
Output is correct |
25 |
Correct |
107 ms |
36416 KB |
Output is correct |
26 |
Correct |
95 ms |
36428 KB |
Output is correct |
27 |
Correct |
82 ms |
36416 KB |
Output is correct |
28 |
Correct |
93 ms |
36632 KB |
Output is correct |
29 |
Correct |
124 ms |
36532 KB |
Output is correct |
30 |
Correct |
109 ms |
36556 KB |
Output is correct |
31 |
Correct |
1888 ms |
97716 KB |
Output is correct |
32 |
Correct |
1782 ms |
102484 KB |
Output is correct |
33 |
Correct |
1632 ms |
97960 KB |
Output is correct |
34 |
Correct |
1164 ms |
102064 KB |
Output is correct |
35 |
Correct |
1597 ms |
93252 KB |
Output is correct |
36 |
Correct |
1655 ms |
95936 KB |
Output is correct |
37 |
Correct |
2127 ms |
102232 KB |
Output is correct |
38 |
Correct |
31 ms |
27712 KB |
Output is correct |
39 |
Correct |
133 ms |
37260 KB |
Output is correct |
40 |
Correct |
94 ms |
36548 KB |
Output is correct |
41 |
Correct |
96 ms |
36684 KB |
Output is correct |
42 |
Correct |
17 ms |
26172 KB |
Output is correct |
43 |
Correct |
99 ms |
36488 KB |
Output is correct |
44 |
Correct |
86 ms |
36428 KB |
Output is correct |
45 |
Correct |
94 ms |
36376 KB |
Output is correct |
46 |
Correct |
93 ms |
36376 KB |
Output is correct |
47 |
Correct |
93 ms |
36664 KB |
Output is correct |
48 |
Correct |
101 ms |
36508 KB |
Output is correct |
49 |
Correct |
98 ms |
36484 KB |
Output is correct |
50 |
Correct |
1874 ms |
97912 KB |
Output is correct |
51 |
Correct |
1861 ms |
102288 KB |
Output is correct |
52 |
Correct |
1644 ms |
98152 KB |
Output is correct |
53 |
Correct |
1274 ms |
101920 KB |
Output is correct |
54 |
Correct |
1679 ms |
93100 KB |
Output is correct |
55 |
Correct |
1663 ms |
95700 KB |
Output is correct |
56 |
Correct |
2020 ms |
101400 KB |
Output is correct |
57 |
Correct |
2591 ms |
105984 KB |
Output is correct |
58 |
Correct |
2892 ms |
116248 KB |
Output is correct |
59 |
Correct |
2336 ms |
105528 KB |
Output is correct |
60 |
Correct |
1219 ms |
91372 KB |
Output is correct |
61 |
Correct |
2431 ms |
105584 KB |
Output is correct |
62 |
Correct |
2250 ms |
97684 KB |
Output is correct |
63 |
Correct |
14 ms |
26072 KB |
Output is correct |
64 |
Correct |
15 ms |
26068 KB |
Output is correct |
65 |
Correct |
15 ms |
26292 KB |
Output is correct |
66 |
Correct |
30 ms |
27660 KB |
Output is correct |
67 |
Correct |
116 ms |
37168 KB |
Output is correct |
68 |
Correct |
123 ms |
36540 KB |
Output is correct |
69 |
Correct |
96 ms |
36664 KB |
Output is correct |
70 |
Correct |
17 ms |
26236 KB |
Output is correct |
71 |
Correct |
86 ms |
36428 KB |
Output is correct |
72 |
Correct |
114 ms |
36388 KB |
Output is correct |
73 |
Correct |
96 ms |
36464 KB |
Output is correct |
74 |
Correct |
90 ms |
36392 KB |
Output is correct |
75 |
Correct |
88 ms |
36632 KB |
Output is correct |
76 |
Correct |
87 ms |
36556 KB |
Output is correct |
77 |
Correct |
103 ms |
36428 KB |
Output is correct |
78 |
Correct |
1823 ms |
95068 KB |
Output is correct |
79 |
Correct |
1929 ms |
91180 KB |
Output is correct |
80 |
Correct |
1943 ms |
90988 KB |
Output is correct |
81 |
Correct |
1634 ms |
95992 KB |
Output is correct |
82 |
Correct |
1835 ms |
93188 KB |
Output is correct |
83 |
Correct |
1603 ms |
89084 KB |
Output is correct |
84 |
Correct |
1589 ms |
89224 KB |
Output is correct |
85 |
Correct |
1615 ms |
88732 KB |
Output is correct |
86 |
Correct |
1849 ms |
91788 KB |
Output is correct |
87 |
Correct |
1865 ms |
94632 KB |
Output is correct |
88 |
Correct |
1841 ms |
93424 KB |
Output is correct |
89 |
Correct |
1924 ms |
88140 KB |
Output is correct |
90 |
Correct |
1897 ms |
121144 KB |
Output is correct |
91 |
Correct |
15 ms |
26164 KB |
Output is correct |
92 |
Correct |
15 ms |
26068 KB |
Output is correct |
93 |
Correct |
15 ms |
26136 KB |
Output is correct |
94 |
Correct |
35 ms |
27716 KB |
Output is correct |
95 |
Correct |
107 ms |
37212 KB |
Output is correct |
96 |
Correct |
91 ms |
36556 KB |
Output is correct |
97 |
Correct |
90 ms |
36668 KB |
Output is correct |
98 |
Correct |
16 ms |
26196 KB |
Output is correct |
99 |
Correct |
87 ms |
36472 KB |
Output is correct |
100 |
Correct |
89 ms |
36556 KB |
Output is correct |
101 |
Correct |
94 ms |
36460 KB |
Output is correct |
102 |
Correct |
82 ms |
36400 KB |
Output is correct |
103 |
Correct |
88 ms |
36648 KB |
Output is correct |
104 |
Correct |
84 ms |
36568 KB |
Output is correct |
105 |
Correct |
87 ms |
36456 KB |
Output is correct |
106 |
Correct |
1832 ms |
121408 KB |
Output is correct |
107 |
Correct |
1673 ms |
125828 KB |
Output is correct |
108 |
Correct |
1586 ms |
121508 KB |
Output is correct |
109 |
Correct |
1255 ms |
125156 KB |
Output is correct |
110 |
Correct |
1622 ms |
117020 KB |
Output is correct |
111 |
Correct |
1675 ms |
119020 KB |
Output is correct |
112 |
Correct |
1906 ms |
125736 KB |
Output is correct |
113 |
Correct |
1827 ms |
121080 KB |
Output is correct |
114 |
Correct |
1925 ms |
117892 KB |
Output is correct |
115 |
Correct |
1951 ms |
117804 KB |
Output is correct |
116 |
Correct |
1685 ms |
122896 KB |
Output is correct |
117 |
Correct |
1804 ms |
120280 KB |
Output is correct |
118 |
Correct |
1564 ms |
117152 KB |
Output is correct |
119 |
Correct |
1623 ms |
117040 KB |
Output is correct |
120 |
Correct |
1655 ms |
116940 KB |
Output is correct |
121 |
Correct |
1841 ms |
120864 KB |
Output is correct |
122 |
Correct |
1870 ms |
124060 KB |
Output is correct |
123 |
Correct |
1865 ms |
124876 KB |
Output is correct |
124 |
Correct |
1937 ms |
119896 KB |
Output is correct |
125 |
Correct |
1807 ms |
119344 KB |
Output is correct |
126 |
Correct |
1783 ms |
122936 KB |
Output is correct |
127 |
Correct |
1767 ms |
123868 KB |
Output is correct |
128 |
Correct |
1815 ms |
121112 KB |
Output is correct |
129 |
Correct |
1644 ms |
119796 KB |
Output is correct |
130 |
Correct |
1799 ms |
121956 KB |
Output is correct |
131 |
Correct |
1953 ms |
121336 KB |
Output is correct |
132 |
Correct |
1838 ms |
121284 KB |
Output is correct |
133 |
Correct |
15 ms |
26164 KB |
Output is correct |
134 |
Correct |
14 ms |
26084 KB |
Output is correct |
135 |
Correct |
14 ms |
26104 KB |
Output is correct |
136 |
Correct |
30 ms |
27724 KB |
Output is correct |
137 |
Correct |
96 ms |
37288 KB |
Output is correct |
138 |
Correct |
93 ms |
36428 KB |
Output is correct |
139 |
Correct |
94 ms |
36640 KB |
Output is correct |
140 |
Correct |
18 ms |
26164 KB |
Output is correct |
141 |
Correct |
89 ms |
36432 KB |
Output is correct |
142 |
Correct |
98 ms |
36572 KB |
Output is correct |
143 |
Correct |
82 ms |
36384 KB |
Output is correct |
144 |
Correct |
82 ms |
36460 KB |
Output is correct |
145 |
Correct |
93 ms |
36684 KB |
Output is correct |
146 |
Correct |
94 ms |
36556 KB |
Output is correct |
147 |
Correct |
87 ms |
36504 KB |
Output is correct |
148 |
Correct |
1902 ms |
120240 KB |
Output is correct |
149 |
Correct |
1804 ms |
124592 KB |
Output is correct |
150 |
Correct |
1598 ms |
120644 KB |
Output is correct |
151 |
Correct |
1273 ms |
124348 KB |
Output is correct |
152 |
Correct |
1645 ms |
116252 KB |
Output is correct |
153 |
Correct |
1640 ms |
118220 KB |
Output is correct |
154 |
Correct |
1959 ms |
124884 KB |
Output is correct |
155 |
Correct |
2460 ms |
130660 KB |
Output is correct |
156 |
Correct |
2769 ms |
140976 KB |
Output is correct |
157 |
Correct |
2263 ms |
130948 KB |
Output is correct |
158 |
Correct |
1263 ms |
116588 KB |
Output is correct |
159 |
Correct |
2512 ms |
131040 KB |
Output is correct |
160 |
Correct |
2394 ms |
123536 KB |
Output is correct |
161 |
Correct |
1956 ms |
122016 KB |
Output is correct |
162 |
Correct |
1872 ms |
118392 KB |
Output is correct |
163 |
Correct |
1937 ms |
117968 KB |
Output is correct |
164 |
Correct |
1734 ms |
122856 KB |
Output is correct |
165 |
Correct |
1884 ms |
120308 KB |
Output is correct |
166 |
Correct |
1673 ms |
116632 KB |
Output is correct |
167 |
Correct |
1750 ms |
116868 KB |
Output is correct |
168 |
Correct |
1617 ms |
116844 KB |
Output is correct |
169 |
Correct |
1836 ms |
120404 KB |
Output is correct |
170 |
Correct |
2012 ms |
124180 KB |
Output is correct |
171 |
Correct |
1960 ms |
124200 KB |
Output is correct |
172 |
Correct |
2039 ms |
120176 KB |
Output is correct |
173 |
Correct |
1838 ms |
120040 KB |
Output is correct |
174 |
Correct |
1870 ms |
122316 KB |
Output is correct |
175 |
Correct |
1733 ms |
123648 KB |
Output is correct |
176 |
Correct |
1852 ms |
121092 KB |
Output is correct |
177 |
Correct |
1657 ms |
120004 KB |
Output is correct |
178 |
Correct |
1824 ms |
121412 KB |
Output is correct |
179 |
Correct |
1979 ms |
120952 KB |
Output is correct |
180 |
Correct |
1869 ms |
121264 KB |
Output is correct |
181 |
Correct |
1867 ms |
123380 KB |
Output is correct |
182 |
Correct |
1748 ms |
126036 KB |
Output is correct |
183 |
Correct |
2557 ms |
131548 KB |
Output is correct |
184 |
Correct |
2338 ms |
134732 KB |
Output is correct |
185 |
Correct |
2569 ms |
126316 KB |
Output is correct |
186 |
Correct |
2241 ms |
119560 KB |
Output is correct |
187 |
Correct |
1642 ms |
117944 KB |
Output is correct |