#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const int N=250005;
const int L=2755;
const int Z=1005;
int n,m,z,kk;
vector<int>adj[N];
int love[N],ssk[L];
int s[Z],l[Z],col[L],ord[L];
int e[L][L];
ll ed1[L][L],eb1[L][L];
ll d[L],b[L];
typedef pair<ll,pair<int,int> > plii;
priority_queue<plii,vector<plii>,greater<plii> >pq;
ll d1[N];
ll d2[L],b2[L];
ll d3[L][L],b3[L][L];
bool vis1[N];
bool vis2[L];
bool vis3[L][L];
int main(){
ios::sync_with_stdio(false);
cin >> n >> m;
for(int i=1; i<=m ;i++){
int u,v;cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
for(int i=1; i<=n ;i++){
adj[i].push_back(i);
love[i]=-1;
}
cin >> z;
for(int i=1; i<=z ;i++){
cin >> l[i];
s[i+1]=s[i]+l[i];
for(int j=0; j<l[i] ;j++){
int x;cin >> x;
ssk[s[i]+j]=x;
love[x]=s[i]+j;
col[s[i]+j]=i;
ord[s[i]+j]=j;
}
}
/*for(int i=1; i<=n ;i++) cout << love[i] << ' ';
cout << endl;
for(int i=0; i<s[z+1] ;i++) cout << ssk[i] << ' ';
cout << endl;*/
kk=s[z+1];
for(int i=1; i<=n ;i++){
if(love[i]==-1) continue;
for(auto c:adj[i]){
if(love[c]!=-1) e[love[i]][love[c]]=1;
}
}
for(int i=1; i<=z ;i++){
for(int j=1; j<l[i] ;j++){
e[s[i]+j][s[i]+j-1]=0;
}
e[s[i]][s[i]+l[i]-1]=0;
}
for(int i=1; i<=z ;i++){
for(int j=1; j<=z ;j++){
for(int k=0; k<l[j] ;k++){
d[k]=1e18;
}
for(int k=l[i]-1; k>=0 ;k--){
for(int h=l[j]; h>0 ;h--){
d[h]=d[h-1]+1;b[h]=b[h-1];
}
d[0]=d[l[j]];b[0]=b[l[j]];
for(int h=0; h<l[j] ;h++){
if(!e[s[i]+k][s[j]+h]) continue;
int nx=(1-h+l[j])%l[j];//distance-order
d[nx]=1;b[nx]=h+s[j];
}
}
for(int k=l[i]-1; k>=0 ;k--){
for(int h=l[j]; h>0 ;h--){
d[h]=d[h-1]+1;b[h]=b[h-1];
}
d[0]=d[l[j]];b[0]=b[l[j]];
for(int h=0; h<l[j] ;h++){
if(!e[s[i]+k][s[j]+h]) continue;
int nx=(1-h+l[j])%l[j];//distance-order
d[nx]=1;b[nx]=h+s[j];
}
for(int h=0; h<l[j] ;h++){
ed1[s[i]+k][s[j]+h]=d[h];
eb1[s[i]+k][s[j]+h]=b[h];
}
}
}
}
for(int i=1; i<=n ;i++) d1[i]=1e18;
for(int i=0; i<kk ;i++){
d2[i]=1e18;
for(int j=0; j<kk ;j++){
d3[i][j]=1e18;
}
}
d1[1]=0;
pq.push({0,{1,1}});
while(!pq.empty()){
auto tmp=pq.top().se;pq.pop();
if(tmp.fi==1){//only exists for non-guarded nodes
int x=tmp.se;
if(vis1[x]) continue;
//cout << "d1 " << x << ' ' << d1[x] << endl;
vis1[x]=true;
for(auto c:adj[x]){
if(love[c]==-1){
if(d1[c]>d1[x]+1){
d1[c]=d1[x]+1;
pq.push({d1[c],{1,c}});
}
}
else if(love[x]==-1){
int y=love[c];
int i=col[y];
int j=ord[y];
{//move immediately
if(j==(d1[x]+1)%l[i]);//cant move
else{
int nx=s[i]+(d1[x]+1-j+l[i])%l[i];
if(d2[nx]>d1[x]+1){
d2[nx]=d1[x]+1;b2[nx]=y;
pq.push({d2[nx],{2,nx}});
}
}
}
{//wait until guard passed before enter
ll wait=(j-d1[x])%l[i];
wait=(wait+l[i])%l[i];
int nx=s[i]+1;
if(d2[nx]>d1[x]+wait+1){
d2[nx]=d1[x]+wait+1;b2[nx]=y;
pq.push({d2[nx],{2,nx}});
}
}
}
else if(col[love[x]]==col[love[c]] && ord[love[c]]==(ord[love[x]]+1)%l[col[love[x]]]){//walk on cycle
if(d1[c]>d1[x]+1){
d1[c]=d1[x]+1;
pq.push({d1[c],{1,c}});
}
}
}
}
else if(tmp.fi==2){
int x=tmp.se;
if(vis2[x]) continue;
//cout << "d2 " << x << ' ' << d2[x] << ' ' << b2[x] << endl;
int y=b2[x];//where you actually at
int i=col[y];
vis2[x]=true;
{//go to d1 without change in time
int c=ssk[y];
if(d1[c]>d2[x]){
d1[c]=d2[x];
pq.push({d1[c],{1,c}});
}
}
{//go to d2 walking cycle in reverse direction
if(x+2<s[i]+l[i]){
int nx=x+2;
if(d2[nx]>d2[x]+1){
d2[nx]=d2[x]+1;b2[nx]=s[i]+(y-s[i]+l[i]-1)%l[i];
pq.push({d2[nx],{2,nx}});
}
}
}
{//go to d3
for(int j=1; j<=z ;j++){
for(int k=0; k<l[j] ;k++){
int ny=(d2[x]+k)%l[j]+s[j];
ll nd=d2[x]+ed1[y][k+s[j]];
if(d3[x][ny]>d2[x]+ed1[y][k+s[j]]){
d3[x][ny]=d2[x]+ed1[y][k+s[j]];
b3[x][ny]=eb1[y][k+s[j]];
pq.push({d3[x][ny],{3,x*L+ny}});
}
}
}
}
}
else{
int x=tmp.se/L;
int y=tmp.se%L;
if(vis3[x][y]) continue;
//cout << "d3 " << x << ' ' << y << ' ' << d3[x][y] << ' ' << b3[x][y] << endl;
vis3[x][y]=true;
int i=col[x];
int j=col[y];
{//go to d2
if(y!=s[j]){
if(d2[y]>d3[x][y]){
d2[y]=d3[x][y];b2[y]=b3[x][y];
pq.push({d2[y],{2,y}});
}
}
}
{
int ny=(y-s[j]+l[i])%l[j]+s[j];
if(d3[x][ny]>d3[x][y]+l[i]){
d3[x][ny]=d3[x][y]+l[i];b3[x][ny]=b3[x][y];
pq.push({d3[x][ny],{3,x*L+ny}});
}
}
}
}
if(d1[n]==1e18) cout << "impossible\n";
else cout << d1[n] << '\n';
}
Compilation message
watchmen.cpp: In function 'int main()':
watchmen.cpp:184:10: warning: unused variable 'nd' [-Wunused-variable]
184 | ll nd=d2[x]+ed1[y][k+s[j]];
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
10952 KB |
Output is correct |
2 |
Correct |
94 ms |
13868 KB |
Output is correct |
3 |
Correct |
90 ms |
13836 KB |
Output is correct |
4 |
Correct |
78 ms |
14092 KB |
Output is correct |
5 |
Correct |
6 ms |
9420 KB |
Output is correct |
6 |
Correct |
72 ms |
13792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
10952 KB |
Output is correct |
2 |
Correct |
91 ms |
13868 KB |
Output is correct |
3 |
Correct |
68 ms |
13764 KB |
Output is correct |
4 |
Correct |
91 ms |
14112 KB |
Output is correct |
5 |
Correct |
7 ms |
9420 KB |
Output is correct |
6 |
Correct |
65 ms |
13796 KB |
Output is correct |
7 |
Correct |
68 ms |
13644 KB |
Output is correct |
8 |
Correct |
71 ms |
14796 KB |
Output is correct |
9 |
Correct |
72 ms |
14788 KB |
Output is correct |
10 |
Correct |
79 ms |
14916 KB |
Output is correct |
11 |
Correct |
85 ms |
14908 KB |
Output is correct |
12 |
Correct |
87 ms |
14916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
10952 KB |
Output is correct |
2 |
Correct |
91 ms |
13868 KB |
Output is correct |
3 |
Correct |
68 ms |
13764 KB |
Output is correct |
4 |
Correct |
91 ms |
14112 KB |
Output is correct |
5 |
Correct |
7 ms |
9420 KB |
Output is correct |
6 |
Correct |
65 ms |
13796 KB |
Output is correct |
7 |
Correct |
68 ms |
13644 KB |
Output is correct |
8 |
Correct |
71 ms |
14796 KB |
Output is correct |
9 |
Correct |
72 ms |
14788 KB |
Output is correct |
10 |
Correct |
79 ms |
14916 KB |
Output is correct |
11 |
Correct |
85 ms |
14908 KB |
Output is correct |
12 |
Correct |
87 ms |
14916 KB |
Output is correct |
13 |
Correct |
27 ms |
11552 KB |
Output is correct |
14 |
Correct |
86 ms |
14944 KB |
Output is correct |
15 |
Correct |
97 ms |
14952 KB |
Output is correct |
16 |
Correct |
86 ms |
15292 KB |
Output is correct |
17 |
Correct |
6 ms |
9396 KB |
Output is correct |
18 |
Correct |
66 ms |
14912 KB |
Output is correct |
19 |
Correct |
85 ms |
14776 KB |
Output is correct |
20 |
Correct |
71 ms |
14788 KB |
Output is correct |
21 |
Correct |
66 ms |
14704 KB |
Output is correct |
22 |
Correct |
104 ms |
14956 KB |
Output is correct |
23 |
Correct |
84 ms |
14928 KB |
Output is correct |
24 |
Correct |
140 ms |
15020 KB |
Output is correct |
25 |
Correct |
2064 ms |
64544 KB |
Output is correct |
26 |
Correct |
1944 ms |
76392 KB |
Output is correct |
27 |
Correct |
1892 ms |
69008 KB |
Output is correct |
28 |
Correct |
1614 ms |
72312 KB |
Output is correct |
29 |
Correct |
1949 ms |
58436 KB |
Output is correct |
30 |
Correct |
1984 ms |
67352 KB |
Output is correct |
31 |
Correct |
2155 ms |
76364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
10952 KB |
Output is correct |
2 |
Correct |
91 ms |
13868 KB |
Output is correct |
3 |
Correct |
68 ms |
13764 KB |
Output is correct |
4 |
Correct |
91 ms |
14112 KB |
Output is correct |
5 |
Correct |
7 ms |
9420 KB |
Output is correct |
6 |
Correct |
65 ms |
13796 KB |
Output is correct |
7 |
Correct |
68 ms |
13644 KB |
Output is correct |
8 |
Correct |
71 ms |
14796 KB |
Output is correct |
9 |
Correct |
72 ms |
14788 KB |
Output is correct |
10 |
Correct |
79 ms |
14916 KB |
Output is correct |
11 |
Correct |
85 ms |
14908 KB |
Output is correct |
12 |
Correct |
87 ms |
14916 KB |
Output is correct |
13 |
Correct |
27 ms |
11552 KB |
Output is correct |
14 |
Correct |
86 ms |
14944 KB |
Output is correct |
15 |
Correct |
97 ms |
14952 KB |
Output is correct |
16 |
Correct |
86 ms |
15292 KB |
Output is correct |
17 |
Correct |
6 ms |
9396 KB |
Output is correct |
18 |
Correct |
66 ms |
14912 KB |
Output is correct |
19 |
Correct |
85 ms |
14776 KB |
Output is correct |
20 |
Correct |
71 ms |
14788 KB |
Output is correct |
21 |
Correct |
66 ms |
14704 KB |
Output is correct |
22 |
Correct |
104 ms |
14956 KB |
Output is correct |
23 |
Correct |
84 ms |
14928 KB |
Output is correct |
24 |
Correct |
140 ms |
15020 KB |
Output is correct |
25 |
Correct |
2064 ms |
64544 KB |
Output is correct |
26 |
Correct |
1944 ms |
76392 KB |
Output is correct |
27 |
Correct |
1892 ms |
69008 KB |
Output is correct |
28 |
Correct |
1614 ms |
72312 KB |
Output is correct |
29 |
Correct |
1949 ms |
58436 KB |
Output is correct |
30 |
Correct |
1984 ms |
67352 KB |
Output is correct |
31 |
Correct |
2155 ms |
76364 KB |
Output is correct |
32 |
Correct |
28 ms |
11528 KB |
Output is correct |
33 |
Correct |
99 ms |
15012 KB |
Output is correct |
34 |
Correct |
77 ms |
14956 KB |
Output is correct |
35 |
Correct |
112 ms |
15304 KB |
Output is correct |
36 |
Correct |
8 ms |
9420 KB |
Output is correct |
37 |
Correct |
91 ms |
14900 KB |
Output is correct |
38 |
Correct |
81 ms |
14768 KB |
Output is correct |
39 |
Correct |
79 ms |
14800 KB |
Output is correct |
40 |
Correct |
101 ms |
14768 KB |
Output is correct |
41 |
Correct |
97 ms |
14852 KB |
Output is correct |
42 |
Correct |
94 ms |
14852 KB |
Output is correct |
43 |
Correct |
76 ms |
14956 KB |
Output is correct |
44 |
Correct |
2099 ms |
64628 KB |
Output is correct |
45 |
Correct |
1937 ms |
76512 KB |
Output is correct |
46 |
Correct |
1889 ms |
68980 KB |
Output is correct |
47 |
Correct |
1432 ms |
72376 KB |
Output is correct |
48 |
Correct |
1895 ms |
91652 KB |
Output is correct |
49 |
Correct |
1837 ms |
100228 KB |
Output is correct |
50 |
Correct |
2168 ms |
109304 KB |
Output is correct |
51 |
Correct |
2138 ms |
179168 KB |
Output is correct |
52 |
Correct |
2225 ms |
305812 KB |
Output is correct |
53 |
Correct |
2105 ms |
297416 KB |
Output is correct |
54 |
Correct |
1534 ms |
287684 KB |
Output is correct |
55 |
Correct |
2493 ms |
262216 KB |
Output is correct |
56 |
Correct |
2302 ms |
257736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
10952 KB |
Output is correct |
2 |
Correct |
94 ms |
13868 KB |
Output is correct |
3 |
Correct |
90 ms |
13836 KB |
Output is correct |
4 |
Correct |
78 ms |
14092 KB |
Output is correct |
5 |
Correct |
6 ms |
9420 KB |
Output is correct |
6 |
Correct |
72 ms |
13792 KB |
Output is correct |
7 |
Correct |
26 ms |
10952 KB |
Output is correct |
8 |
Correct |
91 ms |
13868 KB |
Output is correct |
9 |
Correct |
68 ms |
13764 KB |
Output is correct |
10 |
Correct |
91 ms |
14112 KB |
Output is correct |
11 |
Correct |
7 ms |
9420 KB |
Output is correct |
12 |
Correct |
65 ms |
13796 KB |
Output is correct |
13 |
Correct |
68 ms |
13644 KB |
Output is correct |
14 |
Correct |
71 ms |
14796 KB |
Output is correct |
15 |
Correct |
72 ms |
14788 KB |
Output is correct |
16 |
Correct |
79 ms |
14916 KB |
Output is correct |
17 |
Correct |
85 ms |
14908 KB |
Output is correct |
18 |
Correct |
87 ms |
14916 KB |
Output is correct |
19 |
Correct |
5 ms |
6460 KB |
Output is correct |
20 |
Correct |
4 ms |
6348 KB |
Output is correct |
21 |
Correct |
5 ms |
6348 KB |
Output is correct |
22 |
Correct |
27 ms |
11468 KB |
Output is correct |
23 |
Correct |
73 ms |
14992 KB |
Output is correct |
24 |
Correct |
77 ms |
14992 KB |
Output is correct |
25 |
Correct |
83 ms |
15360 KB |
Output is correct |
26 |
Correct |
7 ms |
9408 KB |
Output is correct |
27 |
Correct |
72 ms |
14916 KB |
Output is correct |
28 |
Correct |
92 ms |
14916 KB |
Output is correct |
29 |
Correct |
83 ms |
14868 KB |
Output is correct |
30 |
Correct |
65 ms |
14744 KB |
Output is correct |
31 |
Correct |
79 ms |
14916 KB |
Output is correct |
32 |
Correct |
92 ms |
14892 KB |
Output is correct |
33 |
Correct |
71 ms |
14868 KB |
Output is correct |
34 |
Correct |
1944 ms |
95852 KB |
Output is correct |
35 |
Correct |
2041 ms |
93640 KB |
Output is correct |
36 |
Correct |
1988 ms |
93608 KB |
Output is correct |
37 |
Correct |
1723 ms |
99040 KB |
Output is correct |
38 |
Correct |
1951 ms |
85412 KB |
Output is correct |
39 |
Correct |
1686 ms |
78708 KB |
Output is correct |
40 |
Correct |
1808 ms |
80640 KB |
Output is correct |
41 |
Correct |
1796 ms |
80132 KB |
Output is correct |
42 |
Correct |
2037 ms |
85248 KB |
Output is correct |
43 |
Correct |
2059 ms |
92300 KB |
Output is correct |
44 |
Correct |
2009 ms |
92092 KB |
Output is correct |
45 |
Correct |
2118 ms |
84860 KB |
Output is correct |
46 |
Correct |
1882 ms |
85220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
10952 KB |
Output is correct |
2 |
Correct |
94 ms |
13868 KB |
Output is correct |
3 |
Correct |
90 ms |
13836 KB |
Output is correct |
4 |
Correct |
78 ms |
14092 KB |
Output is correct |
5 |
Correct |
6 ms |
9420 KB |
Output is correct |
6 |
Correct |
72 ms |
13792 KB |
Output is correct |
7 |
Correct |
26 ms |
10952 KB |
Output is correct |
8 |
Correct |
91 ms |
13868 KB |
Output is correct |
9 |
Correct |
68 ms |
13764 KB |
Output is correct |
10 |
Correct |
91 ms |
14112 KB |
Output is correct |
11 |
Correct |
7 ms |
9420 KB |
Output is correct |
12 |
Correct |
65 ms |
13796 KB |
Output is correct |
13 |
Correct |
68 ms |
13644 KB |
Output is correct |
14 |
Correct |
71 ms |
14796 KB |
Output is correct |
15 |
Correct |
72 ms |
14788 KB |
Output is correct |
16 |
Correct |
79 ms |
14916 KB |
Output is correct |
17 |
Correct |
85 ms |
14908 KB |
Output is correct |
18 |
Correct |
87 ms |
14916 KB |
Output is correct |
19 |
Correct |
27 ms |
11552 KB |
Output is correct |
20 |
Correct |
86 ms |
14944 KB |
Output is correct |
21 |
Correct |
97 ms |
14952 KB |
Output is correct |
22 |
Correct |
86 ms |
15292 KB |
Output is correct |
23 |
Correct |
6 ms |
9396 KB |
Output is correct |
24 |
Correct |
66 ms |
14912 KB |
Output is correct |
25 |
Correct |
85 ms |
14776 KB |
Output is correct |
26 |
Correct |
71 ms |
14788 KB |
Output is correct |
27 |
Correct |
66 ms |
14704 KB |
Output is correct |
28 |
Correct |
104 ms |
14956 KB |
Output is correct |
29 |
Correct |
84 ms |
14928 KB |
Output is correct |
30 |
Correct |
140 ms |
15020 KB |
Output is correct |
31 |
Correct |
2064 ms |
64544 KB |
Output is correct |
32 |
Correct |
1944 ms |
76392 KB |
Output is correct |
33 |
Correct |
1892 ms |
69008 KB |
Output is correct |
34 |
Correct |
1614 ms |
72312 KB |
Output is correct |
35 |
Correct |
1949 ms |
58436 KB |
Output is correct |
36 |
Correct |
1984 ms |
67352 KB |
Output is correct |
37 |
Correct |
2155 ms |
76364 KB |
Output is correct |
38 |
Correct |
5 ms |
6460 KB |
Output is correct |
39 |
Correct |
4 ms |
6348 KB |
Output is correct |
40 |
Correct |
5 ms |
6348 KB |
Output is correct |
41 |
Correct |
27 ms |
11468 KB |
Output is correct |
42 |
Correct |
73 ms |
14992 KB |
Output is correct |
43 |
Correct |
77 ms |
14992 KB |
Output is correct |
44 |
Correct |
83 ms |
15360 KB |
Output is correct |
45 |
Correct |
7 ms |
9408 KB |
Output is correct |
46 |
Correct |
72 ms |
14916 KB |
Output is correct |
47 |
Correct |
92 ms |
14916 KB |
Output is correct |
48 |
Correct |
83 ms |
14868 KB |
Output is correct |
49 |
Correct |
65 ms |
14744 KB |
Output is correct |
50 |
Correct |
79 ms |
14916 KB |
Output is correct |
51 |
Correct |
92 ms |
14892 KB |
Output is correct |
52 |
Correct |
71 ms |
14868 KB |
Output is correct |
53 |
Correct |
1944 ms |
95852 KB |
Output is correct |
54 |
Correct |
2041 ms |
93640 KB |
Output is correct |
55 |
Correct |
1988 ms |
93608 KB |
Output is correct |
56 |
Correct |
1723 ms |
99040 KB |
Output is correct |
57 |
Correct |
1951 ms |
85412 KB |
Output is correct |
58 |
Correct |
1686 ms |
78708 KB |
Output is correct |
59 |
Correct |
1808 ms |
80640 KB |
Output is correct |
60 |
Correct |
1796 ms |
80132 KB |
Output is correct |
61 |
Correct |
2037 ms |
85248 KB |
Output is correct |
62 |
Correct |
2059 ms |
92300 KB |
Output is correct |
63 |
Correct |
2009 ms |
92092 KB |
Output is correct |
64 |
Correct |
2118 ms |
84860 KB |
Output is correct |
65 |
Correct |
1882 ms |
85220 KB |
Output is correct |
66 |
Correct |
5 ms |
6348 KB |
Output is correct |
67 |
Correct |
4 ms |
6476 KB |
Output is correct |
68 |
Correct |
4 ms |
6416 KB |
Output is correct |
69 |
Correct |
27 ms |
11496 KB |
Output is correct |
70 |
Correct |
66 ms |
15000 KB |
Output is correct |
71 |
Correct |
82 ms |
14908 KB |
Output is correct |
72 |
Correct |
88 ms |
15272 KB |
Output is correct |
73 |
Correct |
6 ms |
9420 KB |
Output is correct |
74 |
Correct |
78 ms |
14984 KB |
Output is correct |
75 |
Correct |
67 ms |
14812 KB |
Output is correct |
76 |
Correct |
64 ms |
14812 KB |
Output is correct |
77 |
Correct |
65 ms |
14752 KB |
Output is correct |
78 |
Correct |
83 ms |
14944 KB |
Output is correct |
79 |
Correct |
68 ms |
14864 KB |
Output is correct |
80 |
Correct |
76 ms |
14896 KB |
Output is correct |
81 |
Correct |
1972 ms |
87740 KB |
Output is correct |
82 |
Correct |
1810 ms |
99648 KB |
Output is correct |
83 |
Correct |
1974 ms |
92084 KB |
Output is correct |
84 |
Correct |
1318 ms |
95316 KB |
Output is correct |
85 |
Correct |
1761 ms |
80108 KB |
Output is correct |
86 |
Correct |
1771 ms |
90404 KB |
Output is correct |
87 |
Correct |
2062 ms |
99464 KB |
Output is correct |
88 |
Correct |
2095 ms |
86052 KB |
Output is correct |
89 |
Correct |
2156 ms |
83932 KB |
Output is correct |
90 |
Correct |
2159 ms |
83764 KB |
Output is correct |
91 |
Correct |
2067 ms |
89176 KB |
Output is correct |
92 |
Correct |
2304 ms |
85260 KB |
Output is correct |
93 |
Correct |
1855 ms |
78956 KB |
Output is correct |
94 |
Correct |
2051 ms |
80696 KB |
Output is correct |
95 |
Correct |
1993 ms |
80088 KB |
Output is correct |
96 |
Correct |
2114 ms |
85392 KB |
Output is correct |
97 |
Correct |
2178 ms |
92016 KB |
Output is correct |
98 |
Correct |
2103 ms |
92160 KB |
Output is correct |
99 |
Correct |
2156 ms |
84860 KB |
Output is correct |
100 |
Correct |
1909 ms |
85024 KB |
Output is correct |
101 |
Correct |
2013 ms |
93172 KB |
Output is correct |
102 |
Correct |
1916 ms |
96456 KB |
Output is correct |
103 |
Correct |
1972 ms |
93508 KB |
Output is correct |
104 |
Correct |
1778 ms |
90448 KB |
Output is correct |
105 |
Correct |
2122 ms |
94048 KB |
Output is correct |
106 |
Correct |
2100 ms |
92480 KB |
Output is correct |
107 |
Correct |
2041 ms |
92524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
10952 KB |
Output is correct |
2 |
Correct |
94 ms |
13868 KB |
Output is correct |
3 |
Correct |
90 ms |
13836 KB |
Output is correct |
4 |
Correct |
78 ms |
14092 KB |
Output is correct |
5 |
Correct |
6 ms |
9420 KB |
Output is correct |
6 |
Correct |
72 ms |
13792 KB |
Output is correct |
7 |
Correct |
26 ms |
10952 KB |
Output is correct |
8 |
Correct |
91 ms |
13868 KB |
Output is correct |
9 |
Correct |
68 ms |
13764 KB |
Output is correct |
10 |
Correct |
91 ms |
14112 KB |
Output is correct |
11 |
Correct |
7 ms |
9420 KB |
Output is correct |
12 |
Correct |
65 ms |
13796 KB |
Output is correct |
13 |
Correct |
68 ms |
13644 KB |
Output is correct |
14 |
Correct |
71 ms |
14796 KB |
Output is correct |
15 |
Correct |
72 ms |
14788 KB |
Output is correct |
16 |
Correct |
79 ms |
14916 KB |
Output is correct |
17 |
Correct |
85 ms |
14908 KB |
Output is correct |
18 |
Correct |
87 ms |
14916 KB |
Output is correct |
19 |
Correct |
27 ms |
11552 KB |
Output is correct |
20 |
Correct |
86 ms |
14944 KB |
Output is correct |
21 |
Correct |
97 ms |
14952 KB |
Output is correct |
22 |
Correct |
86 ms |
15292 KB |
Output is correct |
23 |
Correct |
6 ms |
9396 KB |
Output is correct |
24 |
Correct |
66 ms |
14912 KB |
Output is correct |
25 |
Correct |
85 ms |
14776 KB |
Output is correct |
26 |
Correct |
71 ms |
14788 KB |
Output is correct |
27 |
Correct |
66 ms |
14704 KB |
Output is correct |
28 |
Correct |
104 ms |
14956 KB |
Output is correct |
29 |
Correct |
84 ms |
14928 KB |
Output is correct |
30 |
Correct |
140 ms |
15020 KB |
Output is correct |
31 |
Correct |
2064 ms |
64544 KB |
Output is correct |
32 |
Correct |
1944 ms |
76392 KB |
Output is correct |
33 |
Correct |
1892 ms |
69008 KB |
Output is correct |
34 |
Correct |
1614 ms |
72312 KB |
Output is correct |
35 |
Correct |
1949 ms |
58436 KB |
Output is correct |
36 |
Correct |
1984 ms |
67352 KB |
Output is correct |
37 |
Correct |
2155 ms |
76364 KB |
Output is correct |
38 |
Correct |
28 ms |
11528 KB |
Output is correct |
39 |
Correct |
99 ms |
15012 KB |
Output is correct |
40 |
Correct |
77 ms |
14956 KB |
Output is correct |
41 |
Correct |
112 ms |
15304 KB |
Output is correct |
42 |
Correct |
8 ms |
9420 KB |
Output is correct |
43 |
Correct |
91 ms |
14900 KB |
Output is correct |
44 |
Correct |
81 ms |
14768 KB |
Output is correct |
45 |
Correct |
79 ms |
14800 KB |
Output is correct |
46 |
Correct |
101 ms |
14768 KB |
Output is correct |
47 |
Correct |
97 ms |
14852 KB |
Output is correct |
48 |
Correct |
94 ms |
14852 KB |
Output is correct |
49 |
Correct |
76 ms |
14956 KB |
Output is correct |
50 |
Correct |
2099 ms |
64628 KB |
Output is correct |
51 |
Correct |
1937 ms |
76512 KB |
Output is correct |
52 |
Correct |
1889 ms |
68980 KB |
Output is correct |
53 |
Correct |
1432 ms |
72376 KB |
Output is correct |
54 |
Correct |
1895 ms |
91652 KB |
Output is correct |
55 |
Correct |
1837 ms |
100228 KB |
Output is correct |
56 |
Correct |
2168 ms |
109304 KB |
Output is correct |
57 |
Correct |
2138 ms |
179168 KB |
Output is correct |
58 |
Correct |
2225 ms |
305812 KB |
Output is correct |
59 |
Correct |
2105 ms |
297416 KB |
Output is correct |
60 |
Correct |
1534 ms |
287684 KB |
Output is correct |
61 |
Correct |
2493 ms |
262216 KB |
Output is correct |
62 |
Correct |
2302 ms |
257736 KB |
Output is correct |
63 |
Correct |
5 ms |
6460 KB |
Output is correct |
64 |
Correct |
4 ms |
6348 KB |
Output is correct |
65 |
Correct |
5 ms |
6348 KB |
Output is correct |
66 |
Correct |
27 ms |
11468 KB |
Output is correct |
67 |
Correct |
73 ms |
14992 KB |
Output is correct |
68 |
Correct |
77 ms |
14992 KB |
Output is correct |
69 |
Correct |
83 ms |
15360 KB |
Output is correct |
70 |
Correct |
7 ms |
9408 KB |
Output is correct |
71 |
Correct |
72 ms |
14916 KB |
Output is correct |
72 |
Correct |
92 ms |
14916 KB |
Output is correct |
73 |
Correct |
83 ms |
14868 KB |
Output is correct |
74 |
Correct |
65 ms |
14744 KB |
Output is correct |
75 |
Correct |
79 ms |
14916 KB |
Output is correct |
76 |
Correct |
92 ms |
14892 KB |
Output is correct |
77 |
Correct |
71 ms |
14868 KB |
Output is correct |
78 |
Correct |
1944 ms |
95852 KB |
Output is correct |
79 |
Correct |
2041 ms |
93640 KB |
Output is correct |
80 |
Correct |
1988 ms |
93608 KB |
Output is correct |
81 |
Correct |
1723 ms |
99040 KB |
Output is correct |
82 |
Correct |
1951 ms |
85412 KB |
Output is correct |
83 |
Correct |
1686 ms |
78708 KB |
Output is correct |
84 |
Correct |
1808 ms |
80640 KB |
Output is correct |
85 |
Correct |
1796 ms |
80132 KB |
Output is correct |
86 |
Correct |
2037 ms |
85248 KB |
Output is correct |
87 |
Correct |
2059 ms |
92300 KB |
Output is correct |
88 |
Correct |
2009 ms |
92092 KB |
Output is correct |
89 |
Correct |
2118 ms |
84860 KB |
Output is correct |
90 |
Correct |
1882 ms |
85220 KB |
Output is correct |
91 |
Correct |
5 ms |
6348 KB |
Output is correct |
92 |
Correct |
4 ms |
6476 KB |
Output is correct |
93 |
Correct |
4 ms |
6416 KB |
Output is correct |
94 |
Correct |
27 ms |
11496 KB |
Output is correct |
95 |
Correct |
66 ms |
15000 KB |
Output is correct |
96 |
Correct |
82 ms |
14908 KB |
Output is correct |
97 |
Correct |
88 ms |
15272 KB |
Output is correct |
98 |
Correct |
6 ms |
9420 KB |
Output is correct |
99 |
Correct |
78 ms |
14984 KB |
Output is correct |
100 |
Correct |
67 ms |
14812 KB |
Output is correct |
101 |
Correct |
64 ms |
14812 KB |
Output is correct |
102 |
Correct |
65 ms |
14752 KB |
Output is correct |
103 |
Correct |
83 ms |
14944 KB |
Output is correct |
104 |
Correct |
68 ms |
14864 KB |
Output is correct |
105 |
Correct |
76 ms |
14896 KB |
Output is correct |
106 |
Correct |
1972 ms |
87740 KB |
Output is correct |
107 |
Correct |
1810 ms |
99648 KB |
Output is correct |
108 |
Correct |
1974 ms |
92084 KB |
Output is correct |
109 |
Correct |
1318 ms |
95316 KB |
Output is correct |
110 |
Correct |
1761 ms |
80108 KB |
Output is correct |
111 |
Correct |
1771 ms |
90404 KB |
Output is correct |
112 |
Correct |
2062 ms |
99464 KB |
Output is correct |
113 |
Correct |
2095 ms |
86052 KB |
Output is correct |
114 |
Correct |
2156 ms |
83932 KB |
Output is correct |
115 |
Correct |
2159 ms |
83764 KB |
Output is correct |
116 |
Correct |
2067 ms |
89176 KB |
Output is correct |
117 |
Correct |
2304 ms |
85260 KB |
Output is correct |
118 |
Correct |
1855 ms |
78956 KB |
Output is correct |
119 |
Correct |
2051 ms |
80696 KB |
Output is correct |
120 |
Correct |
1993 ms |
80088 KB |
Output is correct |
121 |
Correct |
2114 ms |
85392 KB |
Output is correct |
122 |
Correct |
2178 ms |
92016 KB |
Output is correct |
123 |
Correct |
2103 ms |
92160 KB |
Output is correct |
124 |
Correct |
2156 ms |
84860 KB |
Output is correct |
125 |
Correct |
1909 ms |
85024 KB |
Output is correct |
126 |
Correct |
2013 ms |
93172 KB |
Output is correct |
127 |
Correct |
1916 ms |
96456 KB |
Output is correct |
128 |
Correct |
1972 ms |
93508 KB |
Output is correct |
129 |
Correct |
1778 ms |
90448 KB |
Output is correct |
130 |
Correct |
2122 ms |
94048 KB |
Output is correct |
131 |
Correct |
2100 ms |
92480 KB |
Output is correct |
132 |
Correct |
2041 ms |
92524 KB |
Output is correct |
133 |
Correct |
4 ms |
6348 KB |
Output is correct |
134 |
Correct |
6 ms |
6340 KB |
Output is correct |
135 |
Correct |
5 ms |
6336 KB |
Output is correct |
136 |
Correct |
30 ms |
11568 KB |
Output is correct |
137 |
Correct |
74 ms |
14972 KB |
Output is correct |
138 |
Correct |
69 ms |
14940 KB |
Output is correct |
139 |
Correct |
80 ms |
15264 KB |
Output is correct |
140 |
Correct |
6 ms |
9420 KB |
Output is correct |
141 |
Correct |
87 ms |
14916 KB |
Output is correct |
142 |
Correct |
80 ms |
14780 KB |
Output is correct |
143 |
Correct |
83 ms |
14808 KB |
Output is correct |
144 |
Correct |
65 ms |
14692 KB |
Output is correct |
145 |
Correct |
86 ms |
14936 KB |
Output is correct |
146 |
Correct |
79 ms |
14920 KB |
Output is correct |
147 |
Correct |
70 ms |
14916 KB |
Output is correct |
148 |
Correct |
1862 ms |
87568 KB |
Output is correct |
149 |
Correct |
1928 ms |
99916 KB |
Output is correct |
150 |
Correct |
1821 ms |
92160 KB |
Output is correct |
151 |
Correct |
1532 ms |
95448 KB |
Output is correct |
152 |
Correct |
1878 ms |
79696 KB |
Output is correct |
153 |
Correct |
1926 ms |
90712 KB |
Output is correct |
154 |
Correct |
2084 ms |
99496 KB |
Output is correct |
155 |
Correct |
2103 ms |
169172 KB |
Output is correct |
156 |
Correct |
2189 ms |
295200 KB |
Output is correct |
157 |
Correct |
2182 ms |
287384 KB |
Output is correct |
158 |
Correct |
1675 ms |
277852 KB |
Output is correct |
159 |
Correct |
2640 ms |
252252 KB |
Output is correct |
160 |
Correct |
2476 ms |
247520 KB |
Output is correct |
161 |
Correct |
2145 ms |
86192 KB |
Output is correct |
162 |
Correct |
2332 ms |
83828 KB |
Output is correct |
163 |
Correct |
2136 ms |
83912 KB |
Output is correct |
164 |
Correct |
2009 ms |
89572 KB |
Output is correct |
165 |
Correct |
2276 ms |
85388 KB |
Output is correct |
166 |
Correct |
1946 ms |
77864 KB |
Output is correct |
167 |
Correct |
2061 ms |
81616 KB |
Output is correct |
168 |
Correct |
1872 ms |
79724 KB |
Output is correct |
169 |
Correct |
2136 ms |
84596 KB |
Output is correct |
170 |
Correct |
2123 ms |
90764 KB |
Output is correct |
171 |
Correct |
2074 ms |
90656 KB |
Output is correct |
172 |
Correct |
2277 ms |
83228 KB |
Output is correct |
173 |
Correct |
2049 ms |
82864 KB |
Output is correct |
174 |
Correct |
2135 ms |
90076 KB |
Output is correct |
175 |
Correct |
1952 ms |
92644 KB |
Output is correct |
176 |
Correct |
2254 ms |
89728 KB |
Output is correct |
177 |
Correct |
1961 ms |
85208 KB |
Output is correct |
178 |
Correct |
2199 ms |
87024 KB |
Output is correct |
179 |
Correct |
2234 ms |
85152 KB |
Output is correct |
180 |
Correct |
2215 ms |
85152 KB |
Output is correct |
181 |
Correct |
2256 ms |
270364 KB |
Output is correct |
182 |
Correct |
2181 ms |
286012 KB |
Output is correct |
183 |
Correct |
3311 ms |
312632 KB |
Output is correct |
184 |
Correct |
2925 ms |
313884 KB |
Output is correct |
185 |
Correct |
2872 ms |
363412 KB |
Output is correct |
186 |
Correct |
2831 ms |
290136 KB |
Output is correct |
187 |
Correct |
2614 ms |
334744 KB |
Output is correct |