#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
vi adjList[250000];
pair<int,pii> p[250000];
bool comp(int a,int b) {
return p[a] < p[b];
}
int pos[250000];
vector<LLI> dist[250000];
priority_queue<pair<LLI,int> > H;
int relax(int u,LLI d) {
if ((dist[u][d % p[u].first] == -1) || (d < dist[u][d % p[u].first])) {
dist[u][d % p[u].first] = d;
H.push(mp(-d,u));
}
return 0;
}
int done[250000],done2[250000];
set<pii> done3[250000];
map<int,int> done4[250000];
int main() {
int i,j;
int N,M,K;
int u,v,l;
scanf("%d %d",&N,&M);
for (i = 0; i < M; i++) {
scanf("%d %d",&u,&v);
u--,v--;
adjList[u].pb(v);
adjList[v].pb(u);
}
scanf("%d",&K);
for (i = 0; i < K; i++) {
scanf("%d",&l);
for (j = 0; j < l; j++) scanf("%d",&v),p[v-1] = mp(l,mp(j,i));
}
for (i = 0; i < N; i++) {
if (p[i].first == 0) p[i].first = 1;
dist[i].resize(p[i].first);
fill(dist[i].begin(),dist[i].end(),-1);
}
for (i = 0; i < N; i++) {
sort(adjList[i].begin(),adjList[i].end(),comp);
while ((pos[i] < adjList[i].size()) && (p[adjList[i][pos[i]]].first == 1)) pos[i]++;
}
dist[0][0] = 0,H.push(mp(0,0));
while (!H.empty()) {
int u = H.top().second;
LLI d = -H.top().first;
H.pop();
if (d > dist[u][d % p[u].first]) continue;
else if (u == N-1) {
printf("%lld\n",d);
return 0;
}
if ((p[u].first == 1) || (((d+1) % p[u].first) != p[u].second.first)) relax(u,d+1);
if (done[u] && (dist[u][(d+p[u].first-1) % p[u].first] == d-1)) continue;
for (i = done[u] ? pos[u]:0; i < adjList[u].size(); i++) {
int v = adjList[u][i];
if (p[v].first == 1) relax(v,d+1);
else if (p[u].first == 1) {
if (done2[v]) continue;
else {
for (j = 0; j < p[v].first; j++) {
LLI d2 = d+j+1;
if ((d2 % p[v].first) != p[v].second.first) relax(v,d2);
}
done2[v] = 1;
}
}
else if (p[u].second.second == p[v].second.second) {
if (((d+1) % p[v].first) == p[v].second.first) continue;
if (((d % p[v].first) == p[v].second.first) && (((d+1) % p[u].first) == p[u].second.first)) continue;
relax(v,d+1);
}
else {
done4[v][p[u].second.second]++;
if (done4[v][p[u].second.second] >= 30) continue;
if (done3[v].count(mp(d % p[v].first,p[u].first))) continue;
vector<LLI> dd(p[v].first,-1);
priority_queue<LLI> H2;
for (j = 0; j < ((((p[u].second.first-d) % p[u].first)+p[u].first) % p[u].first); j++) {
if (j == p[v].first) break;
dd[(d+j) % p[v].first] = d+j;
}
for (j = 0; j < p[v].first; j++) {
if (dd[j] != -1) H2.push(-dd[j]);
}
while (!H2.empty()) {
LLI d = -H2.top();
H2.pop();
if (d > dd[d % p[v].first]) continue;
if ((dd[(d+p[u].first) % p[v].first] == -1) || (d+p[u].first < dd[(d+p[u].first) % p[v].first])) {
dd[(d+p[u].first) % p[v].first] = d+p[u].first;
H2.push(-(d+p[u].first));
}
}
for (j = 0; j < p[v].first; j++) {
if (dd[j] != -1) {
LLI d2 = dd[j]+1;
if ((d2 % p[v].first) != p[v].second.first) relax(v,d2);
}
}
done3[v].insert(mp(d % p[v].first,p[u].first));
}
}
done[u] = 1;
}
printf("impossible\n");
return 0;
}
Compilation message
watchmen.cpp: In function 'int main()':
watchmen.cpp:52:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | while ((pos[i] < adjList[i].size()) && (p[adjList[i][pos[i]]].first == 1)) pos[i]++;
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
watchmen.cpp:67:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
67 | for (i = done[u] ? pos[u]:0; i < adjList[u].size(); i++) {
| ~~^~~~~~~~~~~~~~~~~~~
watchmen.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | scanf("%d %d",&N,&M);
| ~~~~~^~~~~~~~~~~~~~~
watchmen.cpp:34:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
34 | scanf("%d %d",&u,&v);
| ~~~~~^~~~~~~~~~~~~~~
watchmen.cpp:39:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
39 | scanf("%d",&K);
| ~~~~~^~~~~~~~~
watchmen.cpp:41:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
41 | scanf("%d",&l);
| ~~~~~^~~~~~~~~
watchmen.cpp:42:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
42 | for (j = 0; j < l; j++) scanf("%d",&v),p[v-1] = mp(l,mp(j,i));
| ~~~~~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
37336 KB |
Output is correct |
2 |
Correct |
153 ms |
44484 KB |
Output is correct |
3 |
Correct |
131 ms |
44192 KB |
Output is correct |
4 |
Correct |
139 ms |
44580 KB |
Output is correct |
5 |
Correct |
25 ms |
35660 KB |
Output is correct |
6 |
Correct |
152 ms |
44356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
37460 KB |
Output is correct |
2 |
Correct |
138 ms |
44484 KB |
Output is correct |
3 |
Correct |
132 ms |
44232 KB |
Output is correct |
4 |
Correct |
157 ms |
44620 KB |
Output is correct |
5 |
Correct |
23 ms |
35668 KB |
Output is correct |
6 |
Correct |
123 ms |
44232 KB |
Output is correct |
7 |
Correct |
122 ms |
43844 KB |
Output is correct |
8 |
Correct |
124 ms |
44028 KB |
Output is correct |
9 |
Correct |
119 ms |
43856 KB |
Output is correct |
10 |
Correct |
128 ms |
44292 KB |
Output is correct |
11 |
Correct |
123 ms |
44144 KB |
Output is correct |
12 |
Correct |
163 ms |
44096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
37460 KB |
Output is correct |
2 |
Correct |
138 ms |
44484 KB |
Output is correct |
3 |
Correct |
132 ms |
44232 KB |
Output is correct |
4 |
Correct |
157 ms |
44620 KB |
Output is correct |
5 |
Correct |
23 ms |
35668 KB |
Output is correct |
6 |
Correct |
123 ms |
44232 KB |
Output is correct |
7 |
Correct |
122 ms |
43844 KB |
Output is correct |
8 |
Correct |
124 ms |
44028 KB |
Output is correct |
9 |
Correct |
119 ms |
43856 KB |
Output is correct |
10 |
Correct |
128 ms |
44292 KB |
Output is correct |
11 |
Correct |
123 ms |
44144 KB |
Output is correct |
12 |
Correct |
163 ms |
44096 KB |
Output is correct |
13 |
Correct |
50 ms |
37392 KB |
Output is correct |
14 |
Correct |
131 ms |
44476 KB |
Output is correct |
15 |
Correct |
168 ms |
44308 KB |
Output is correct |
16 |
Correct |
145 ms |
44596 KB |
Output is correct |
17 |
Correct |
23 ms |
35572 KB |
Output is correct |
18 |
Correct |
137 ms |
44208 KB |
Output is correct |
19 |
Correct |
126 ms |
43776 KB |
Output is correct |
20 |
Correct |
140 ms |
44100 KB |
Output is correct |
21 |
Correct |
120 ms |
43688 KB |
Output is correct |
22 |
Correct |
128 ms |
44192 KB |
Output is correct |
23 |
Correct |
128 ms |
44080 KB |
Output is correct |
24 |
Correct |
132 ms |
44028 KB |
Output is correct |
25 |
Correct |
2943 ms |
88960 KB |
Output is correct |
26 |
Correct |
2971 ms |
93128 KB |
Output is correct |
27 |
Correct |
2635 ms |
89864 KB |
Output is correct |
28 |
Correct |
2040 ms |
92652 KB |
Output is correct |
29 |
Correct |
2709 ms |
86376 KB |
Output is correct |
30 |
Correct |
2757 ms |
89048 KB |
Output is correct |
31 |
Correct |
2864 ms |
93756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
37460 KB |
Output is correct |
2 |
Correct |
138 ms |
44484 KB |
Output is correct |
3 |
Correct |
132 ms |
44232 KB |
Output is correct |
4 |
Correct |
157 ms |
44620 KB |
Output is correct |
5 |
Correct |
23 ms |
35668 KB |
Output is correct |
6 |
Correct |
123 ms |
44232 KB |
Output is correct |
7 |
Correct |
122 ms |
43844 KB |
Output is correct |
8 |
Correct |
124 ms |
44028 KB |
Output is correct |
9 |
Correct |
119 ms |
43856 KB |
Output is correct |
10 |
Correct |
128 ms |
44292 KB |
Output is correct |
11 |
Correct |
123 ms |
44144 KB |
Output is correct |
12 |
Correct |
163 ms |
44096 KB |
Output is correct |
13 |
Correct |
50 ms |
37392 KB |
Output is correct |
14 |
Correct |
131 ms |
44476 KB |
Output is correct |
15 |
Correct |
168 ms |
44308 KB |
Output is correct |
16 |
Correct |
145 ms |
44596 KB |
Output is correct |
17 |
Correct |
23 ms |
35572 KB |
Output is correct |
18 |
Correct |
137 ms |
44208 KB |
Output is correct |
19 |
Correct |
126 ms |
43776 KB |
Output is correct |
20 |
Correct |
140 ms |
44100 KB |
Output is correct |
21 |
Correct |
120 ms |
43688 KB |
Output is correct |
22 |
Correct |
128 ms |
44192 KB |
Output is correct |
23 |
Correct |
128 ms |
44080 KB |
Output is correct |
24 |
Correct |
132 ms |
44028 KB |
Output is correct |
25 |
Correct |
2943 ms |
88960 KB |
Output is correct |
26 |
Correct |
2971 ms |
93128 KB |
Output is correct |
27 |
Correct |
2635 ms |
89864 KB |
Output is correct |
28 |
Correct |
2040 ms |
92652 KB |
Output is correct |
29 |
Correct |
2709 ms |
86376 KB |
Output is correct |
30 |
Correct |
2757 ms |
89048 KB |
Output is correct |
31 |
Correct |
2864 ms |
93756 KB |
Output is correct |
32 |
Correct |
48 ms |
37444 KB |
Output is correct |
33 |
Correct |
140 ms |
44520 KB |
Output is correct |
34 |
Correct |
146 ms |
44232 KB |
Output is correct |
35 |
Correct |
150 ms |
44680 KB |
Output is correct |
36 |
Correct |
23 ms |
35580 KB |
Output is correct |
37 |
Correct |
128 ms |
44276 KB |
Output is correct |
38 |
Correct |
137 ms |
43820 KB |
Output is correct |
39 |
Correct |
117 ms |
44156 KB |
Output is correct |
40 |
Correct |
141 ms |
43696 KB |
Output is correct |
41 |
Correct |
124 ms |
44304 KB |
Output is correct |
42 |
Correct |
146 ms |
44068 KB |
Output is correct |
43 |
Correct |
137 ms |
44056 KB |
Output is correct |
44 |
Correct |
3031 ms |
88852 KB |
Output is correct |
45 |
Correct |
2922 ms |
93220 KB |
Output is correct |
46 |
Correct |
3168 ms |
89768 KB |
Output is correct |
47 |
Correct |
2424 ms |
92532 KB |
Output is correct |
48 |
Correct |
2822 ms |
86176 KB |
Output is correct |
49 |
Correct |
2876 ms |
88876 KB |
Output is correct |
50 |
Correct |
3054 ms |
93736 KB |
Output is correct |
51 |
Correct |
3296 ms |
105968 KB |
Output is correct |
52 |
Correct |
3372 ms |
122596 KB |
Output is correct |
53 |
Correct |
3347 ms |
124236 KB |
Output is correct |
54 |
Correct |
1945 ms |
84980 KB |
Output is correct |
55 |
Correct |
3604 ms |
170780 KB |
Output is correct |
56 |
Correct |
3322 ms |
128628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
37336 KB |
Output is correct |
2 |
Correct |
153 ms |
44484 KB |
Output is correct |
3 |
Correct |
131 ms |
44192 KB |
Output is correct |
4 |
Correct |
139 ms |
44580 KB |
Output is correct |
5 |
Correct |
25 ms |
35660 KB |
Output is correct |
6 |
Correct |
152 ms |
44356 KB |
Output is correct |
7 |
Correct |
49 ms |
37460 KB |
Output is correct |
8 |
Correct |
138 ms |
44484 KB |
Output is correct |
9 |
Correct |
132 ms |
44232 KB |
Output is correct |
10 |
Correct |
157 ms |
44620 KB |
Output is correct |
11 |
Correct |
23 ms |
35668 KB |
Output is correct |
12 |
Correct |
123 ms |
44232 KB |
Output is correct |
13 |
Correct |
122 ms |
43844 KB |
Output is correct |
14 |
Correct |
124 ms |
44028 KB |
Output is correct |
15 |
Correct |
119 ms |
43856 KB |
Output is correct |
16 |
Correct |
128 ms |
44292 KB |
Output is correct |
17 |
Correct |
123 ms |
44144 KB |
Output is correct |
18 |
Correct |
163 ms |
44096 KB |
Output is correct |
19 |
Correct |
25 ms |
35532 KB |
Output is correct |
20 |
Correct |
25 ms |
35532 KB |
Output is correct |
21 |
Correct |
25 ms |
35516 KB |
Output is correct |
22 |
Correct |
52 ms |
37468 KB |
Output is correct |
23 |
Correct |
141 ms |
44604 KB |
Output is correct |
24 |
Correct |
147 ms |
44424 KB |
Output is correct |
25 |
Correct |
146 ms |
44744 KB |
Output is correct |
26 |
Correct |
28 ms |
35668 KB |
Output is correct |
27 |
Correct |
129 ms |
44440 KB |
Output is correct |
28 |
Correct |
136 ms |
43920 KB |
Output is correct |
29 |
Correct |
126 ms |
44228 KB |
Output is correct |
30 |
Correct |
124 ms |
43960 KB |
Output is correct |
31 |
Correct |
129 ms |
44360 KB |
Output is correct |
32 |
Correct |
135 ms |
44180 KB |
Output is correct |
33 |
Correct |
125 ms |
44272 KB |
Output is correct |
34 |
Correct |
3002 ms |
89892 KB |
Output is correct |
35 |
Correct |
2949 ms |
86340 KB |
Output is correct |
36 |
Correct |
2998 ms |
86408 KB |
Output is correct |
37 |
Correct |
2559 ms |
90800 KB |
Output is correct |
38 |
Correct |
2823 ms |
96584 KB |
Output is correct |
39 |
Correct |
2673 ms |
94716 KB |
Output is correct |
40 |
Correct |
2704 ms |
94888 KB |
Output is correct |
41 |
Correct |
2732 ms |
93684 KB |
Output is correct |
42 |
Correct |
2834 ms |
96820 KB |
Output is correct |
43 |
Correct |
2879 ms |
100668 KB |
Output is correct |
44 |
Correct |
3018 ms |
101048 KB |
Output is correct |
45 |
Correct |
3038 ms |
96836 KB |
Output is correct |
46 |
Correct |
2892 ms |
96916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
37336 KB |
Output is correct |
2 |
Correct |
153 ms |
44484 KB |
Output is correct |
3 |
Correct |
131 ms |
44192 KB |
Output is correct |
4 |
Correct |
139 ms |
44580 KB |
Output is correct |
5 |
Correct |
25 ms |
35660 KB |
Output is correct |
6 |
Correct |
152 ms |
44356 KB |
Output is correct |
7 |
Correct |
49 ms |
37460 KB |
Output is correct |
8 |
Correct |
138 ms |
44484 KB |
Output is correct |
9 |
Correct |
132 ms |
44232 KB |
Output is correct |
10 |
Correct |
157 ms |
44620 KB |
Output is correct |
11 |
Correct |
23 ms |
35668 KB |
Output is correct |
12 |
Correct |
123 ms |
44232 KB |
Output is correct |
13 |
Correct |
122 ms |
43844 KB |
Output is correct |
14 |
Correct |
124 ms |
44028 KB |
Output is correct |
15 |
Correct |
119 ms |
43856 KB |
Output is correct |
16 |
Correct |
128 ms |
44292 KB |
Output is correct |
17 |
Correct |
123 ms |
44144 KB |
Output is correct |
18 |
Correct |
163 ms |
44096 KB |
Output is correct |
19 |
Correct |
50 ms |
37392 KB |
Output is correct |
20 |
Correct |
131 ms |
44476 KB |
Output is correct |
21 |
Correct |
168 ms |
44308 KB |
Output is correct |
22 |
Correct |
145 ms |
44596 KB |
Output is correct |
23 |
Correct |
23 ms |
35572 KB |
Output is correct |
24 |
Correct |
137 ms |
44208 KB |
Output is correct |
25 |
Correct |
126 ms |
43776 KB |
Output is correct |
26 |
Correct |
140 ms |
44100 KB |
Output is correct |
27 |
Correct |
120 ms |
43688 KB |
Output is correct |
28 |
Correct |
128 ms |
44192 KB |
Output is correct |
29 |
Correct |
128 ms |
44080 KB |
Output is correct |
30 |
Correct |
132 ms |
44028 KB |
Output is correct |
31 |
Correct |
2943 ms |
88960 KB |
Output is correct |
32 |
Correct |
2971 ms |
93128 KB |
Output is correct |
33 |
Correct |
2635 ms |
89864 KB |
Output is correct |
34 |
Correct |
2040 ms |
92652 KB |
Output is correct |
35 |
Correct |
2709 ms |
86376 KB |
Output is correct |
36 |
Correct |
2757 ms |
89048 KB |
Output is correct |
37 |
Correct |
2864 ms |
93756 KB |
Output is correct |
38 |
Correct |
25 ms |
35532 KB |
Output is correct |
39 |
Correct |
25 ms |
35532 KB |
Output is correct |
40 |
Correct |
25 ms |
35516 KB |
Output is correct |
41 |
Correct |
52 ms |
37468 KB |
Output is correct |
42 |
Correct |
141 ms |
44604 KB |
Output is correct |
43 |
Correct |
147 ms |
44424 KB |
Output is correct |
44 |
Correct |
146 ms |
44744 KB |
Output is correct |
45 |
Correct |
28 ms |
35668 KB |
Output is correct |
46 |
Correct |
129 ms |
44440 KB |
Output is correct |
47 |
Correct |
136 ms |
43920 KB |
Output is correct |
48 |
Correct |
126 ms |
44228 KB |
Output is correct |
49 |
Correct |
124 ms |
43960 KB |
Output is correct |
50 |
Correct |
129 ms |
44360 KB |
Output is correct |
51 |
Correct |
135 ms |
44180 KB |
Output is correct |
52 |
Correct |
125 ms |
44272 KB |
Output is correct |
53 |
Correct |
3002 ms |
89892 KB |
Output is correct |
54 |
Correct |
2949 ms |
86340 KB |
Output is correct |
55 |
Correct |
2998 ms |
86408 KB |
Output is correct |
56 |
Correct |
2559 ms |
90800 KB |
Output is correct |
57 |
Correct |
2823 ms |
96584 KB |
Output is correct |
58 |
Correct |
2673 ms |
94716 KB |
Output is correct |
59 |
Correct |
2704 ms |
94888 KB |
Output is correct |
60 |
Correct |
2732 ms |
93684 KB |
Output is correct |
61 |
Correct |
2834 ms |
96820 KB |
Output is correct |
62 |
Correct |
2879 ms |
100668 KB |
Output is correct |
63 |
Correct |
3018 ms |
101048 KB |
Output is correct |
64 |
Correct |
3038 ms |
96836 KB |
Output is correct |
65 |
Correct |
2892 ms |
96916 KB |
Output is correct |
66 |
Correct |
21 ms |
35436 KB |
Output is correct |
67 |
Correct |
21 ms |
35516 KB |
Output is correct |
68 |
Correct |
23 ms |
35436 KB |
Output is correct |
69 |
Correct |
52 ms |
37484 KB |
Output is correct |
70 |
Correct |
133 ms |
45024 KB |
Output is correct |
71 |
Correct |
127 ms |
44832 KB |
Output is correct |
72 |
Correct |
127 ms |
45128 KB |
Output is correct |
73 |
Correct |
23 ms |
35580 KB |
Output is correct |
74 |
Correct |
134 ms |
44744 KB |
Output is correct |
75 |
Correct |
125 ms |
44392 KB |
Output is correct |
76 |
Correct |
123 ms |
44504 KB |
Output is correct |
77 |
Correct |
117 ms |
44212 KB |
Output is correct |
78 |
Correct |
140 ms |
44844 KB |
Output is correct |
79 |
Correct |
133 ms |
44644 KB |
Output is correct |
80 |
Correct |
127 ms |
44568 KB |
Output is correct |
81 |
Correct |
2861 ms |
96948 KB |
Output is correct |
82 |
Correct |
2666 ms |
101188 KB |
Output is correct |
83 |
Correct |
2552 ms |
97892 KB |
Output is correct |
84 |
Correct |
1979 ms |
100656 KB |
Output is correct |
85 |
Correct |
2691 ms |
94516 KB |
Output is correct |
86 |
Correct |
2713 ms |
97144 KB |
Output is correct |
87 |
Correct |
3088 ms |
101980 KB |
Output is correct |
88 |
Correct |
2960 ms |
97972 KB |
Output is correct |
89 |
Correct |
3032 ms |
94592 KB |
Output is correct |
90 |
Correct |
2951 ms |
94444 KB |
Output is correct |
91 |
Correct |
2630 ms |
99044 KB |
Output is correct |
92 |
Correct |
2821 ms |
96868 KB |
Output is correct |
93 |
Correct |
2653 ms |
94660 KB |
Output is correct |
94 |
Correct |
2692 ms |
94904 KB |
Output is correct |
95 |
Correct |
2679 ms |
93860 KB |
Output is correct |
96 |
Correct |
2834 ms |
97004 KB |
Output is correct |
97 |
Correct |
2947 ms |
100908 KB |
Output is correct |
98 |
Correct |
3001 ms |
101200 KB |
Output is correct |
99 |
Correct |
3017 ms |
96748 KB |
Output is correct |
100 |
Correct |
2789 ms |
96908 KB |
Output is correct |
101 |
Correct |
2835 ms |
98288 KB |
Output is correct |
102 |
Correct |
2639 ms |
99188 KB |
Output is correct |
103 |
Correct |
2841 ms |
96888 KB |
Output is correct |
104 |
Correct |
2683 ms |
98132 KB |
Output is correct |
105 |
Correct |
2868 ms |
98908 KB |
Output is correct |
106 |
Correct |
3089 ms |
96956 KB |
Output is correct |
107 |
Correct |
2816 ms |
98716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
37336 KB |
Output is correct |
2 |
Correct |
153 ms |
44484 KB |
Output is correct |
3 |
Correct |
131 ms |
44192 KB |
Output is correct |
4 |
Correct |
139 ms |
44580 KB |
Output is correct |
5 |
Correct |
25 ms |
35660 KB |
Output is correct |
6 |
Correct |
152 ms |
44356 KB |
Output is correct |
7 |
Correct |
49 ms |
37460 KB |
Output is correct |
8 |
Correct |
138 ms |
44484 KB |
Output is correct |
9 |
Correct |
132 ms |
44232 KB |
Output is correct |
10 |
Correct |
157 ms |
44620 KB |
Output is correct |
11 |
Correct |
23 ms |
35668 KB |
Output is correct |
12 |
Correct |
123 ms |
44232 KB |
Output is correct |
13 |
Correct |
122 ms |
43844 KB |
Output is correct |
14 |
Correct |
124 ms |
44028 KB |
Output is correct |
15 |
Correct |
119 ms |
43856 KB |
Output is correct |
16 |
Correct |
128 ms |
44292 KB |
Output is correct |
17 |
Correct |
123 ms |
44144 KB |
Output is correct |
18 |
Correct |
163 ms |
44096 KB |
Output is correct |
19 |
Correct |
50 ms |
37392 KB |
Output is correct |
20 |
Correct |
131 ms |
44476 KB |
Output is correct |
21 |
Correct |
168 ms |
44308 KB |
Output is correct |
22 |
Correct |
145 ms |
44596 KB |
Output is correct |
23 |
Correct |
23 ms |
35572 KB |
Output is correct |
24 |
Correct |
137 ms |
44208 KB |
Output is correct |
25 |
Correct |
126 ms |
43776 KB |
Output is correct |
26 |
Correct |
140 ms |
44100 KB |
Output is correct |
27 |
Correct |
120 ms |
43688 KB |
Output is correct |
28 |
Correct |
128 ms |
44192 KB |
Output is correct |
29 |
Correct |
128 ms |
44080 KB |
Output is correct |
30 |
Correct |
132 ms |
44028 KB |
Output is correct |
31 |
Correct |
2943 ms |
88960 KB |
Output is correct |
32 |
Correct |
2971 ms |
93128 KB |
Output is correct |
33 |
Correct |
2635 ms |
89864 KB |
Output is correct |
34 |
Correct |
2040 ms |
92652 KB |
Output is correct |
35 |
Correct |
2709 ms |
86376 KB |
Output is correct |
36 |
Correct |
2757 ms |
89048 KB |
Output is correct |
37 |
Correct |
2864 ms |
93756 KB |
Output is correct |
38 |
Correct |
48 ms |
37444 KB |
Output is correct |
39 |
Correct |
140 ms |
44520 KB |
Output is correct |
40 |
Correct |
146 ms |
44232 KB |
Output is correct |
41 |
Correct |
150 ms |
44680 KB |
Output is correct |
42 |
Correct |
23 ms |
35580 KB |
Output is correct |
43 |
Correct |
128 ms |
44276 KB |
Output is correct |
44 |
Correct |
137 ms |
43820 KB |
Output is correct |
45 |
Correct |
117 ms |
44156 KB |
Output is correct |
46 |
Correct |
141 ms |
43696 KB |
Output is correct |
47 |
Correct |
124 ms |
44304 KB |
Output is correct |
48 |
Correct |
146 ms |
44068 KB |
Output is correct |
49 |
Correct |
137 ms |
44056 KB |
Output is correct |
50 |
Correct |
3031 ms |
88852 KB |
Output is correct |
51 |
Correct |
2922 ms |
93220 KB |
Output is correct |
52 |
Correct |
3168 ms |
89768 KB |
Output is correct |
53 |
Correct |
2424 ms |
92532 KB |
Output is correct |
54 |
Correct |
2822 ms |
86176 KB |
Output is correct |
55 |
Correct |
2876 ms |
88876 KB |
Output is correct |
56 |
Correct |
3054 ms |
93736 KB |
Output is correct |
57 |
Correct |
3296 ms |
105968 KB |
Output is correct |
58 |
Correct |
3372 ms |
122596 KB |
Output is correct |
59 |
Correct |
3347 ms |
124236 KB |
Output is correct |
60 |
Correct |
1945 ms |
84980 KB |
Output is correct |
61 |
Correct |
3604 ms |
170780 KB |
Output is correct |
62 |
Correct |
3322 ms |
128628 KB |
Output is correct |
63 |
Correct |
25 ms |
35532 KB |
Output is correct |
64 |
Correct |
25 ms |
35532 KB |
Output is correct |
65 |
Correct |
25 ms |
35516 KB |
Output is correct |
66 |
Correct |
52 ms |
37468 KB |
Output is correct |
67 |
Correct |
141 ms |
44604 KB |
Output is correct |
68 |
Correct |
147 ms |
44424 KB |
Output is correct |
69 |
Correct |
146 ms |
44744 KB |
Output is correct |
70 |
Correct |
28 ms |
35668 KB |
Output is correct |
71 |
Correct |
129 ms |
44440 KB |
Output is correct |
72 |
Correct |
136 ms |
43920 KB |
Output is correct |
73 |
Correct |
126 ms |
44228 KB |
Output is correct |
74 |
Correct |
124 ms |
43960 KB |
Output is correct |
75 |
Correct |
129 ms |
44360 KB |
Output is correct |
76 |
Correct |
135 ms |
44180 KB |
Output is correct |
77 |
Correct |
125 ms |
44272 KB |
Output is correct |
78 |
Correct |
3002 ms |
89892 KB |
Output is correct |
79 |
Correct |
2949 ms |
86340 KB |
Output is correct |
80 |
Correct |
2998 ms |
86408 KB |
Output is correct |
81 |
Correct |
2559 ms |
90800 KB |
Output is correct |
82 |
Correct |
2823 ms |
96584 KB |
Output is correct |
83 |
Correct |
2673 ms |
94716 KB |
Output is correct |
84 |
Correct |
2704 ms |
94888 KB |
Output is correct |
85 |
Correct |
2732 ms |
93684 KB |
Output is correct |
86 |
Correct |
2834 ms |
96820 KB |
Output is correct |
87 |
Correct |
2879 ms |
100668 KB |
Output is correct |
88 |
Correct |
3018 ms |
101048 KB |
Output is correct |
89 |
Correct |
3038 ms |
96836 KB |
Output is correct |
90 |
Correct |
2892 ms |
96916 KB |
Output is correct |
91 |
Correct |
21 ms |
35436 KB |
Output is correct |
92 |
Correct |
21 ms |
35516 KB |
Output is correct |
93 |
Correct |
23 ms |
35436 KB |
Output is correct |
94 |
Correct |
52 ms |
37484 KB |
Output is correct |
95 |
Correct |
133 ms |
45024 KB |
Output is correct |
96 |
Correct |
127 ms |
44832 KB |
Output is correct |
97 |
Correct |
127 ms |
45128 KB |
Output is correct |
98 |
Correct |
23 ms |
35580 KB |
Output is correct |
99 |
Correct |
134 ms |
44744 KB |
Output is correct |
100 |
Correct |
125 ms |
44392 KB |
Output is correct |
101 |
Correct |
123 ms |
44504 KB |
Output is correct |
102 |
Correct |
117 ms |
44212 KB |
Output is correct |
103 |
Correct |
140 ms |
44844 KB |
Output is correct |
104 |
Correct |
133 ms |
44644 KB |
Output is correct |
105 |
Correct |
127 ms |
44568 KB |
Output is correct |
106 |
Correct |
2861 ms |
96948 KB |
Output is correct |
107 |
Correct |
2666 ms |
101188 KB |
Output is correct |
108 |
Correct |
2552 ms |
97892 KB |
Output is correct |
109 |
Correct |
1979 ms |
100656 KB |
Output is correct |
110 |
Correct |
2691 ms |
94516 KB |
Output is correct |
111 |
Correct |
2713 ms |
97144 KB |
Output is correct |
112 |
Correct |
3088 ms |
101980 KB |
Output is correct |
113 |
Correct |
2960 ms |
97972 KB |
Output is correct |
114 |
Correct |
3032 ms |
94592 KB |
Output is correct |
115 |
Correct |
2951 ms |
94444 KB |
Output is correct |
116 |
Correct |
2630 ms |
99044 KB |
Output is correct |
117 |
Correct |
2821 ms |
96868 KB |
Output is correct |
118 |
Correct |
2653 ms |
94660 KB |
Output is correct |
119 |
Correct |
2692 ms |
94904 KB |
Output is correct |
120 |
Correct |
2679 ms |
93860 KB |
Output is correct |
121 |
Correct |
2834 ms |
97004 KB |
Output is correct |
122 |
Correct |
2947 ms |
100908 KB |
Output is correct |
123 |
Correct |
3001 ms |
101200 KB |
Output is correct |
124 |
Correct |
3017 ms |
96748 KB |
Output is correct |
125 |
Correct |
2789 ms |
96908 KB |
Output is correct |
126 |
Correct |
2835 ms |
98288 KB |
Output is correct |
127 |
Correct |
2639 ms |
99188 KB |
Output is correct |
128 |
Correct |
2841 ms |
96888 KB |
Output is correct |
129 |
Correct |
2683 ms |
98132 KB |
Output is correct |
130 |
Correct |
2868 ms |
98908 KB |
Output is correct |
131 |
Correct |
3089 ms |
96956 KB |
Output is correct |
132 |
Correct |
2816 ms |
98716 KB |
Output is correct |
133 |
Correct |
24 ms |
35520 KB |
Output is correct |
134 |
Correct |
23 ms |
35528 KB |
Output is correct |
135 |
Correct |
24 ms |
35532 KB |
Output is correct |
136 |
Correct |
53 ms |
37488 KB |
Output is correct |
137 |
Correct |
152 ms |
44936 KB |
Output is correct |
138 |
Correct |
128 ms |
44716 KB |
Output is correct |
139 |
Correct |
148 ms |
45256 KB |
Output is correct |
140 |
Correct |
26 ms |
35660 KB |
Output is correct |
141 |
Correct |
131 ms |
44812 KB |
Output is correct |
142 |
Correct |
128 ms |
44320 KB |
Output is correct |
143 |
Correct |
123 ms |
44612 KB |
Output is correct |
144 |
Correct |
121 ms |
44328 KB |
Output is correct |
145 |
Correct |
132 ms |
44780 KB |
Output is correct |
146 |
Correct |
124 ms |
44564 KB |
Output is correct |
147 |
Correct |
124 ms |
44540 KB |
Output is correct |
148 |
Correct |
2848 ms |
97200 KB |
Output is correct |
149 |
Correct |
2656 ms |
101252 KB |
Output is correct |
150 |
Correct |
2484 ms |
98092 KB |
Output is correct |
151 |
Correct |
2029 ms |
100812 KB |
Output is correct |
152 |
Correct |
2659 ms |
94672 KB |
Output is correct |
153 |
Correct |
2689 ms |
97080 KB |
Output is correct |
154 |
Correct |
2984 ms |
102152 KB |
Output is correct |
155 |
Correct |
3306 ms |
114376 KB |
Output is correct |
156 |
Correct |
3383 ms |
130584 KB |
Output is correct |
157 |
Correct |
3223 ms |
132312 KB |
Output is correct |
158 |
Correct |
1936 ms |
93124 KB |
Output is correct |
159 |
Correct |
3604 ms |
178884 KB |
Output is correct |
160 |
Correct |
3321 ms |
136736 KB |
Output is correct |
161 |
Correct |
2842 ms |
98048 KB |
Output is correct |
162 |
Correct |
3000 ms |
94708 KB |
Output is correct |
163 |
Correct |
2927 ms |
94576 KB |
Output is correct |
164 |
Correct |
2555 ms |
98948 KB |
Output is correct |
165 |
Correct |
2835 ms |
96780 KB |
Output is correct |
166 |
Correct |
2655 ms |
94800 KB |
Output is correct |
167 |
Correct |
2626 ms |
94964 KB |
Output is correct |
168 |
Correct |
2817 ms |
93764 KB |
Output is correct |
169 |
Correct |
2827 ms |
96988 KB |
Output is correct |
170 |
Correct |
2953 ms |
100580 KB |
Output is correct |
171 |
Correct |
2918 ms |
101256 KB |
Output is correct |
172 |
Correct |
3015 ms |
96580 KB |
Output is correct |
173 |
Correct |
2844 ms |
96732 KB |
Output is correct |
174 |
Correct |
2842 ms |
97892 KB |
Output is correct |
175 |
Correct |
2595 ms |
99052 KB |
Output is correct |
176 |
Correct |
2905 ms |
96780 KB |
Output is correct |
177 |
Correct |
2695 ms |
97464 KB |
Output is correct |
178 |
Correct |
2804 ms |
98072 KB |
Output is correct |
179 |
Correct |
3061 ms |
95656 KB |
Output is correct |
180 |
Correct |
2949 ms |
97172 KB |
Output is correct |
181 |
Correct |
2858 ms |
97260 KB |
Output is correct |
182 |
Correct |
2658 ms |
99616 KB |
Output is correct |
183 |
Correct |
3322 ms |
113820 KB |
Output is correct |
184 |
Correct |
4082 ms |
173332 KB |
Output is correct |
185 |
Correct |
4301 ms |
230016 KB |
Output is correct |
186 |
Correct |
3192 ms |
128516 KB |
Output is correct |
187 |
Correct |
4046 ms |
239724 KB |
Output is correct |