#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=5e5+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}};
int r,c,n;
pii s,g;
vector<vector<bool> > mp,vis;
vector<set<int> > rw,col;
vector<vector<int> > dis;
bool in(int x,int y) {
return x>=0 and x<r and y>=0 and y<c;
}
bool inrg(int vx,int vy,int tgx,int tgy) {
int dx=abs(tgx-vx);
int dy=abs(tgy-vy);
if (max(dx,dy)<=n and !(dx==n and dy==n)) return true;
return false;
}
int main() {
speed;
cin>>r>>c>>n;
cin>>s.first>>s.second;
s.first--;s.second--;
cin>>g.first>>g.second;
g.first--;g.second--;
mp.resize(r,vector<bool>(c));
dis.resize(r,vector<int>(c,INF));
vis.resize(r,vector<bool>(c,0));
for (int i=0;i<r;i++) {
for (int j=0;j<c;j++) {
char c;
cin>>c;
if (c=='.') mp[i][j]=0;
else mp[i][j]=1;
}
}
rw.resize(r);
col.resize(c);
for (int i=0;i<r;i++) {
for (int j=0;j<c;j++) {
rw[i].insert(j);
col[j].insert(i);
}
}
deque<pii> DBFS;
dis[s.first][s.second]=0;
DBFS.push_front(s);
while (!DBFS.empty()) {
while (!DBFS.empty() and vis[DBFS.front().first][DBFS.front().second]) DBFS.pop_front();
if (DBFS.empty()) break;
auto [vx,vy]=DBFS.front();
// cout<<vx<<" "<<vy<<" v\n"<<flush;
DBFS.pop_front();
vis[vx][vy]=true;
rw[vx].erase(vy);
col[vy].erase(vx);
for (int k=0;k<4;k++) {
int nx=vx+dir[k][0];
int ny=vy+dir[k][1];
// cout<<nx<<" "<<ny<<" n\n";
// if (in(nx,ny)) cout<<dis[nx][ny]<<" "<<dis[vx][vy]<<" "<<mp[nx][ny]<<"\n";
if (in(nx,ny) and !mp[nx][ny] and dis[nx][ny]>dis[vx][vy]) {
DBFS.push_front({nx,ny});
dis[nx][ny]=dis[vx][vy];
}
}
if (inrg(vx,vy,g.first,g.second)) {
if (dis[g.first][g.second]>dis[vx][vy]+1) {
dis[g.first][g.second]=dis[vx][vy]+1;
DBFS.push_back(g);
}
continue;
}
if (vx-n>=0) {
int nx=vx-n;
int ny=max(0,vy-n+1)-1;
auto it=rw[nx].upper_bound(ny);
while (it!=rw[nx].end() and *it<min(c,vy+n)) { // up
ny=*it;
// cout<<nx<<" "<<ny<<" nU\n";
if (dis[nx][ny]>dis[vx][vy]+1) {
DBFS.push_back({nx,ny});
dis[nx][ny]=dis[vx][vy]+1;
}
it=rw[nx].upper_bound(ny);
}
}
if (vx+n<r) {
int nx=vx+n;
int ny=max(0,vy-n+1)-1;
auto it=rw[nx].upper_bound(ny);
while (it!=rw[nx].end() and *it<min(c,vy+n)) { // down
ny=*it;
// cout<<nx<<" "<<ny<<" nD\n";
if (dis[nx][ny]>dis[vx][vy]+1) {
DBFS.push_back({nx,ny});
dis[nx][ny]=dis[vx][vy]+1;
}
it=rw[nx].upper_bound(ny);
}
}
if (vy+n<c) {
int ny=vy+n;
int nx=max(0,vx-n+1)-1;
auto it=col[ny].upper_bound(nx);
while (it!=col[ny].end() and *it<min(r,vx+n)) { // right
nx=*it;
// cout<<nx<<" "<<ny<<" nR\n";
if (dis[nx][ny]>dis[vx][vy]+1) {
DBFS.push_back({nx,ny});
dis[nx][ny]=dis[vx][vy]+1;
}
it=col[ny].upper_bound(nx);
}
}
if (vy-n>=0) {
int ny=vy-n;
int nx=max(0,vx-n+1)-1;
auto it=col[ny].upper_bound(nx);
while (it!=col[ny].end() and *it<min(r,vx+n)) { // left
nx=*it;
// cout<<nx<<" "<<ny<<" nL\n";
if (dis[nx][ny]>dis[vx][vy]+1) {
DBFS.push_back({nx,ny});
dis[nx][ny]=dis[vx][vy]+1;
}
it=col[ny].upper_bound(nx);
}
}
}
// for (int i=0;i<r;i++) {
// for (int j=0;j<c;j++) cout<<dis[i][j]<<" ";
// cout<<"\n";
// }
cout<<dis[g.first][g.second]<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
456 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
30 ms |
6440 KB |
Output is correct |
20 |
Correct |
14 ms |
7076 KB |
Output is correct |
21 |
Correct |
31 ms |
6608 KB |
Output is correct |
22 |
Correct |
35 ms |
6236 KB |
Output is correct |
23 |
Correct |
25 ms |
6236 KB |
Output is correct |
24 |
Correct |
20 ms |
9328 KB |
Output is correct |
25 |
Correct |
17 ms |
9072 KB |
Output is correct |
26 |
Correct |
37 ms |
6236 KB |
Output is correct |
27 |
Correct |
34 ms |
6656 KB |
Output is correct |
28 |
Correct |
28 ms |
6232 KB |
Output is correct |
29 |
Correct |
75 ms |
15376 KB |
Output is correct |
30 |
Correct |
25 ms |
7888 KB |
Output is correct |
31 |
Correct |
87 ms |
15864 KB |
Output is correct |
32 |
Correct |
90 ms |
15180 KB |
Output is correct |
33 |
Correct |
77 ms |
15196 KB |
Output is correct |
34 |
Correct |
51 ms |
22276 KB |
Output is correct |
35 |
Correct |
57 ms |
22476 KB |
Output is correct |
36 |
Correct |
95 ms |
15196 KB |
Output is correct |
37 |
Correct |
92 ms |
15396 KB |
Output is correct |
38 |
Correct |
84 ms |
15220 KB |
Output is correct |
39 |
Correct |
1012 ms |
149128 KB |
Output is correct |
40 |
Correct |
108 ms |
17744 KB |
Output is correct |
41 |
Correct |
66 ms |
27280 KB |
Output is correct |
42 |
Correct |
121 ms |
21748 KB |
Output is correct |
43 |
Correct |
97 ms |
30072 KB |
Output is correct |
44 |
Correct |
507 ms |
79716 KB |
Output is correct |
45 |
Correct |
453 ms |
87008 KB |
Output is correct |
46 |
Correct |
1117 ms |
153944 KB |
Output is correct |
47 |
Correct |
1056 ms |
149044 KB |
Output is correct |
48 |
Correct |
1080 ms |
149076 KB |
Output is correct |
49 |
Correct |
608 ms |
219328 KB |
Output is correct |
50 |
Correct |
578 ms |
219248 KB |
Output is correct |
51 |
Correct |
1207 ms |
148816 KB |
Output is correct |
52 |
Correct |
1180 ms |
149076 KB |
Output is correct |
53 |
Correct |
1163 ms |
149240 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
452 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
2 ms |
604 KB |
Output is correct |
25 |
Correct |
25 ms |
4268 KB |
Output is correct |
26 |
Correct |
50 ms |
6292 KB |
Output is correct |
27 |
Correct |
30 ms |
6488 KB |
Output is correct |
28 |
Correct |
22 ms |
6488 KB |
Output is correct |
29 |
Correct |
12 ms |
6236 KB |
Output is correct |
30 |
Correct |
12 ms |
6360 KB |
Output is correct |
31 |
Correct |
29 ms |
6236 KB |
Output is correct |
32 |
Correct |
35 ms |
6232 KB |
Output is correct |
33 |
Correct |
37 ms |
6480 KB |
Output is correct |
34 |
Correct |
370 ms |
13140 KB |
Output is correct |
35 |
Correct |
87 ms |
15696 KB |
Output is correct |
36 |
Correct |
75 ms |
15952 KB |
Output is correct |
37 |
Correct |
40 ms |
15364 KB |
Output is correct |
38 |
Correct |
37 ms |
15188 KB |
Output is correct |
39 |
Correct |
1051 ms |
46188 KB |
Output is correct |
40 |
Execution timed out |
2077 ms |
131896 KB |
Time limit exceeded |
41 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
30 ms |
6236 KB |
Output is correct |
34 |
Correct |
2 ms |
604 KB |
Output is correct |
35 |
Correct |
1 ms |
860 KB |
Output is correct |
36 |
Correct |
24 ms |
4056 KB |
Output is correct |
37 |
Correct |
14 ms |
7076 KB |
Output is correct |
38 |
Correct |
45 ms |
6228 KB |
Output is correct |
39 |
Correct |
30 ms |
6492 KB |
Output is correct |
40 |
Correct |
35 ms |
6236 KB |
Output is correct |
41 |
Correct |
25 ms |
6236 KB |
Output is correct |
42 |
Correct |
22 ms |
6492 KB |
Output is correct |
43 |
Correct |
16 ms |
6488 KB |
Output is correct |
44 |
Correct |
12 ms |
6236 KB |
Output is correct |
45 |
Correct |
19 ms |
9152 KB |
Output is correct |
46 |
Correct |
18 ms |
9072 KB |
Output is correct |
47 |
Correct |
19 ms |
7740 KB |
Output is correct |
48 |
Correct |
24 ms |
6492 KB |
Output is correct |
49 |
Correct |
29 ms |
6492 KB |
Output is correct |
50 |
Correct |
38 ms |
6492 KB |
Output is correct |
51 |
Correct |
29 ms |
6476 KB |
Output is correct |
52 |
Correct |
35 ms |
6468 KB |
Output is correct |
53 |
Correct |
36 ms |
6452 KB |
Output is correct |
54 |
Correct |
28 ms |
6236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
30 ms |
6236 KB |
Output is correct |
34 |
Correct |
2 ms |
604 KB |
Output is correct |
35 |
Correct |
1 ms |
860 KB |
Output is correct |
36 |
Correct |
24 ms |
4056 KB |
Output is correct |
37 |
Correct |
14 ms |
7076 KB |
Output is correct |
38 |
Correct |
45 ms |
6228 KB |
Output is correct |
39 |
Correct |
30 ms |
6492 KB |
Output is correct |
40 |
Correct |
35 ms |
6236 KB |
Output is correct |
41 |
Correct |
25 ms |
6236 KB |
Output is correct |
42 |
Correct |
22 ms |
6492 KB |
Output is correct |
43 |
Correct |
16 ms |
6488 KB |
Output is correct |
44 |
Correct |
12 ms |
6236 KB |
Output is correct |
45 |
Correct |
19 ms |
9152 KB |
Output is correct |
46 |
Correct |
18 ms |
9072 KB |
Output is correct |
47 |
Correct |
19 ms |
7740 KB |
Output is correct |
48 |
Correct |
24 ms |
6492 KB |
Output is correct |
49 |
Correct |
29 ms |
6492 KB |
Output is correct |
50 |
Correct |
38 ms |
6492 KB |
Output is correct |
51 |
Correct |
29 ms |
6476 KB |
Output is correct |
52 |
Correct |
35 ms |
6468 KB |
Output is correct |
53 |
Correct |
36 ms |
6452 KB |
Output is correct |
54 |
Correct |
28 ms |
6236 KB |
Output is correct |
55 |
Correct |
78 ms |
15364 KB |
Output is correct |
56 |
Correct |
26 ms |
7772 KB |
Output is correct |
57 |
Correct |
373 ms |
13316 KB |
Output is correct |
58 |
Correct |
84 ms |
14416 KB |
Output is correct |
59 |
Correct |
90 ms |
15888 KB |
Output is correct |
60 |
Correct |
96 ms |
15188 KB |
Output is correct |
61 |
Correct |
76 ms |
15192 KB |
Output is correct |
62 |
Correct |
67 ms |
15708 KB |
Output is correct |
63 |
Correct |
37 ms |
15188 KB |
Output is correct |
64 |
Correct |
37 ms |
15196 KB |
Output is correct |
65 |
Correct |
63 ms |
22140 KB |
Output is correct |
66 |
Correct |
53 ms |
22116 KB |
Output is correct |
67 |
Correct |
57 ms |
18728 KB |
Output is correct |
68 |
Correct |
76 ms |
15452 KB |
Output is correct |
69 |
Correct |
100 ms |
15344 KB |
Output is correct |
70 |
Correct |
138 ms |
15452 KB |
Output is correct |
71 |
Correct |
157 ms |
15452 KB |
Output is correct |
72 |
Correct |
94 ms |
15348 KB |
Output is correct |
73 |
Correct |
93 ms |
15364 KB |
Output is correct |
74 |
Correct |
81 ms |
15184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
456 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
30 ms |
6440 KB |
Output is correct |
20 |
Correct |
14 ms |
7076 KB |
Output is correct |
21 |
Correct |
31 ms |
6608 KB |
Output is correct |
22 |
Correct |
35 ms |
6236 KB |
Output is correct |
23 |
Correct |
25 ms |
6236 KB |
Output is correct |
24 |
Correct |
20 ms |
9328 KB |
Output is correct |
25 |
Correct |
17 ms |
9072 KB |
Output is correct |
26 |
Correct |
37 ms |
6236 KB |
Output is correct |
27 |
Correct |
34 ms |
6656 KB |
Output is correct |
28 |
Correct |
28 ms |
6232 KB |
Output is correct |
29 |
Correct |
75 ms |
15376 KB |
Output is correct |
30 |
Correct |
25 ms |
7888 KB |
Output is correct |
31 |
Correct |
87 ms |
15864 KB |
Output is correct |
32 |
Correct |
90 ms |
15180 KB |
Output is correct |
33 |
Correct |
77 ms |
15196 KB |
Output is correct |
34 |
Correct |
51 ms |
22276 KB |
Output is correct |
35 |
Correct |
57 ms |
22476 KB |
Output is correct |
36 |
Correct |
95 ms |
15196 KB |
Output is correct |
37 |
Correct |
92 ms |
15396 KB |
Output is correct |
38 |
Correct |
84 ms |
15220 KB |
Output is correct |
39 |
Correct |
1012 ms |
149128 KB |
Output is correct |
40 |
Correct |
108 ms |
17744 KB |
Output is correct |
41 |
Correct |
66 ms |
27280 KB |
Output is correct |
42 |
Correct |
121 ms |
21748 KB |
Output is correct |
43 |
Correct |
97 ms |
30072 KB |
Output is correct |
44 |
Correct |
507 ms |
79716 KB |
Output is correct |
45 |
Correct |
453 ms |
87008 KB |
Output is correct |
46 |
Correct |
1117 ms |
153944 KB |
Output is correct |
47 |
Correct |
1056 ms |
149044 KB |
Output is correct |
48 |
Correct |
1080 ms |
149076 KB |
Output is correct |
49 |
Correct |
608 ms |
219328 KB |
Output is correct |
50 |
Correct |
578 ms |
219248 KB |
Output is correct |
51 |
Correct |
1207 ms |
148816 KB |
Output is correct |
52 |
Correct |
1180 ms |
149076 KB |
Output is correct |
53 |
Correct |
1163 ms |
149240 KB |
Output is correct |
54 |
Correct |
0 ms |
360 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
0 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
1 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
344 KB |
Output is correct |
69 |
Correct |
1 ms |
604 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 KB |
Output is correct |
78 |
Correct |
0 ms |
348 KB |
Output is correct |
79 |
Correct |
0 ms |
348 KB |
Output is correct |
80 |
Correct |
0 ms |
348 KB |
Output is correct |
81 |
Correct |
1 ms |
344 KB |
Output is correct |
82 |
Correct |
1 ms |
604 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
1 ms |
348 KB |
Output is correct |
85 |
Correct |
1 ms |
344 KB |
Output is correct |
86 |
Correct |
1 ms |
348 KB |
Output is correct |
87 |
Correct |
0 ms |
348 KB |
Output is correct |
88 |
Correct |
0 ms |
348 KB |
Output is correct |
89 |
Correct |
0 ms |
344 KB |
Output is correct |
90 |
Correct |
0 ms |
344 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
1 ms |
348 KB |
Output is correct |
93 |
Correct |
1 ms |
348 KB |
Output is correct |
94 |
Correct |
1 ms |
348 KB |
Output is correct |
95 |
Correct |
1 ms |
344 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
1 ms |
348 KB |
Output is correct |
98 |
Correct |
0 ms |
348 KB |
Output is correct |
99 |
Correct |
1 ms |
348 KB |
Output is correct |
100 |
Correct |
1 ms |
348 KB |
Output is correct |
101 |
Correct |
1 ms |
348 KB |
Output is correct |
102 |
Correct |
0 ms |
348 KB |
Output is correct |
103 |
Correct |
0 ms |
348 KB |
Output is correct |
104 |
Correct |
0 ms |
348 KB |
Output is correct |
105 |
Correct |
0 ms |
452 KB |
Output is correct |
106 |
Correct |
1 ms |
344 KB |
Output is correct |
107 |
Correct |
1 ms |
348 KB |
Output is correct |
108 |
Correct |
1 ms |
348 KB |
Output is correct |
109 |
Correct |
2 ms |
604 KB |
Output is correct |
110 |
Correct |
25 ms |
4268 KB |
Output is correct |
111 |
Correct |
50 ms |
6292 KB |
Output is correct |
112 |
Correct |
30 ms |
6488 KB |
Output is correct |
113 |
Correct |
22 ms |
6488 KB |
Output is correct |
114 |
Correct |
12 ms |
6236 KB |
Output is correct |
115 |
Correct |
12 ms |
6360 KB |
Output is correct |
116 |
Correct |
29 ms |
6236 KB |
Output is correct |
117 |
Correct |
35 ms |
6232 KB |
Output is correct |
118 |
Correct |
37 ms |
6480 KB |
Output is correct |
119 |
Correct |
370 ms |
13140 KB |
Output is correct |
120 |
Correct |
87 ms |
15696 KB |
Output is correct |
121 |
Correct |
75 ms |
15952 KB |
Output is correct |
122 |
Correct |
40 ms |
15364 KB |
Output is correct |
123 |
Correct |
37 ms |
15188 KB |
Output is correct |
124 |
Correct |
1051 ms |
46188 KB |
Output is correct |
125 |
Execution timed out |
2077 ms |
131896 KB |
Time limit exceeded |
126 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
456 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
30 ms |
6440 KB |
Output is correct |
20 |
Correct |
14 ms |
7076 KB |
Output is correct |
21 |
Correct |
31 ms |
6608 KB |
Output is correct |
22 |
Correct |
35 ms |
6236 KB |
Output is correct |
23 |
Correct |
25 ms |
6236 KB |
Output is correct |
24 |
Correct |
20 ms |
9328 KB |
Output is correct |
25 |
Correct |
17 ms |
9072 KB |
Output is correct |
26 |
Correct |
37 ms |
6236 KB |
Output is correct |
27 |
Correct |
34 ms |
6656 KB |
Output is correct |
28 |
Correct |
28 ms |
6232 KB |
Output is correct |
29 |
Correct |
75 ms |
15376 KB |
Output is correct |
30 |
Correct |
25 ms |
7888 KB |
Output is correct |
31 |
Correct |
87 ms |
15864 KB |
Output is correct |
32 |
Correct |
90 ms |
15180 KB |
Output is correct |
33 |
Correct |
77 ms |
15196 KB |
Output is correct |
34 |
Correct |
51 ms |
22276 KB |
Output is correct |
35 |
Correct |
57 ms |
22476 KB |
Output is correct |
36 |
Correct |
95 ms |
15196 KB |
Output is correct |
37 |
Correct |
92 ms |
15396 KB |
Output is correct |
38 |
Correct |
84 ms |
15220 KB |
Output is correct |
39 |
Correct |
1012 ms |
149128 KB |
Output is correct |
40 |
Correct |
108 ms |
17744 KB |
Output is correct |
41 |
Correct |
66 ms |
27280 KB |
Output is correct |
42 |
Correct |
121 ms |
21748 KB |
Output is correct |
43 |
Correct |
97 ms |
30072 KB |
Output is correct |
44 |
Correct |
507 ms |
79716 KB |
Output is correct |
45 |
Correct |
453 ms |
87008 KB |
Output is correct |
46 |
Correct |
1117 ms |
153944 KB |
Output is correct |
47 |
Correct |
1056 ms |
149044 KB |
Output is correct |
48 |
Correct |
1080 ms |
149076 KB |
Output is correct |
49 |
Correct |
608 ms |
219328 KB |
Output is correct |
50 |
Correct |
578 ms |
219248 KB |
Output is correct |
51 |
Correct |
1207 ms |
148816 KB |
Output is correct |
52 |
Correct |
1180 ms |
149076 KB |
Output is correct |
53 |
Correct |
1163 ms |
149240 KB |
Output is correct |
54 |
Correct |
0 ms |
360 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
0 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
1 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
344 KB |
Output is correct |
69 |
Correct |
1 ms |
604 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 KB |
Output is correct |
78 |
Correct |
0 ms |
348 KB |
Output is correct |
79 |
Correct |
0 ms |
348 KB |
Output is correct |
80 |
Correct |
0 ms |
348 KB |
Output is correct |
81 |
Correct |
1 ms |
344 KB |
Output is correct |
82 |
Correct |
1 ms |
604 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
1 ms |
348 KB |
Output is correct |
85 |
Correct |
1 ms |
344 KB |
Output is correct |
86 |
Correct |
1 ms |
348 KB |
Output is correct |
87 |
Correct |
0 ms |
348 KB |
Output is correct |
88 |
Correct |
0 ms |
348 KB |
Output is correct |
89 |
Correct |
0 ms |
344 KB |
Output is correct |
90 |
Correct |
0 ms |
344 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
1 ms |
348 KB |
Output is correct |
93 |
Correct |
1 ms |
348 KB |
Output is correct |
94 |
Correct |
1 ms |
348 KB |
Output is correct |
95 |
Correct |
1 ms |
344 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
1 ms |
348 KB |
Output is correct |
98 |
Correct |
0 ms |
348 KB |
Output is correct |
99 |
Correct |
1 ms |
348 KB |
Output is correct |
100 |
Correct |
1 ms |
348 KB |
Output is correct |
101 |
Correct |
1 ms |
348 KB |
Output is correct |
102 |
Correct |
0 ms |
348 KB |
Output is correct |
103 |
Correct |
0 ms |
348 KB |
Output is correct |
104 |
Correct |
0 ms |
348 KB |
Output is correct |
105 |
Correct |
0 ms |
452 KB |
Output is correct |
106 |
Correct |
1 ms |
344 KB |
Output is correct |
107 |
Correct |
1 ms |
348 KB |
Output is correct |
108 |
Correct |
1 ms |
348 KB |
Output is correct |
109 |
Correct |
2 ms |
604 KB |
Output is correct |
110 |
Correct |
25 ms |
4268 KB |
Output is correct |
111 |
Correct |
50 ms |
6292 KB |
Output is correct |
112 |
Correct |
30 ms |
6488 KB |
Output is correct |
113 |
Correct |
22 ms |
6488 KB |
Output is correct |
114 |
Correct |
12 ms |
6236 KB |
Output is correct |
115 |
Correct |
12 ms |
6360 KB |
Output is correct |
116 |
Correct |
29 ms |
6236 KB |
Output is correct |
117 |
Correct |
35 ms |
6232 KB |
Output is correct |
118 |
Correct |
37 ms |
6480 KB |
Output is correct |
119 |
Correct |
370 ms |
13140 KB |
Output is correct |
120 |
Correct |
87 ms |
15696 KB |
Output is correct |
121 |
Correct |
75 ms |
15952 KB |
Output is correct |
122 |
Correct |
40 ms |
15364 KB |
Output is correct |
123 |
Correct |
37 ms |
15188 KB |
Output is correct |
124 |
Correct |
1051 ms |
46188 KB |
Output is correct |
125 |
Execution timed out |
2077 ms |
131896 KB |
Time limit exceeded |
126 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
456 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
30 ms |
6440 KB |
Output is correct |
20 |
Correct |
14 ms |
7076 KB |
Output is correct |
21 |
Correct |
31 ms |
6608 KB |
Output is correct |
22 |
Correct |
35 ms |
6236 KB |
Output is correct |
23 |
Correct |
25 ms |
6236 KB |
Output is correct |
24 |
Correct |
20 ms |
9328 KB |
Output is correct |
25 |
Correct |
17 ms |
9072 KB |
Output is correct |
26 |
Correct |
37 ms |
6236 KB |
Output is correct |
27 |
Correct |
34 ms |
6656 KB |
Output is correct |
28 |
Correct |
28 ms |
6232 KB |
Output is correct |
29 |
Correct |
75 ms |
15376 KB |
Output is correct |
30 |
Correct |
25 ms |
7888 KB |
Output is correct |
31 |
Correct |
87 ms |
15864 KB |
Output is correct |
32 |
Correct |
90 ms |
15180 KB |
Output is correct |
33 |
Correct |
77 ms |
15196 KB |
Output is correct |
34 |
Correct |
51 ms |
22276 KB |
Output is correct |
35 |
Correct |
57 ms |
22476 KB |
Output is correct |
36 |
Correct |
95 ms |
15196 KB |
Output is correct |
37 |
Correct |
92 ms |
15396 KB |
Output is correct |
38 |
Correct |
84 ms |
15220 KB |
Output is correct |
39 |
Correct |
1012 ms |
149128 KB |
Output is correct |
40 |
Correct |
108 ms |
17744 KB |
Output is correct |
41 |
Correct |
66 ms |
27280 KB |
Output is correct |
42 |
Correct |
121 ms |
21748 KB |
Output is correct |
43 |
Correct |
97 ms |
30072 KB |
Output is correct |
44 |
Correct |
507 ms |
79716 KB |
Output is correct |
45 |
Correct |
453 ms |
87008 KB |
Output is correct |
46 |
Correct |
1117 ms |
153944 KB |
Output is correct |
47 |
Correct |
1056 ms |
149044 KB |
Output is correct |
48 |
Correct |
1080 ms |
149076 KB |
Output is correct |
49 |
Correct |
608 ms |
219328 KB |
Output is correct |
50 |
Correct |
578 ms |
219248 KB |
Output is correct |
51 |
Correct |
1207 ms |
148816 KB |
Output is correct |
52 |
Correct |
1180 ms |
149076 KB |
Output is correct |
53 |
Correct |
1163 ms |
149240 KB |
Output is correct |
54 |
Correct |
0 ms |
360 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
0 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
1 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
1 ms |
348 KB |
Output is correct |
66 |
Correct |
1 ms |
348 KB |
Output is correct |
67 |
Correct |
1 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
344 KB |
Output is correct |
69 |
Correct |
1 ms |
604 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
1 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
1 ms |
348 KB |
Output is correct |
76 |
Correct |
1 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 KB |
Output is correct |
78 |
Correct |
0 ms |
348 KB |
Output is correct |
79 |
Correct |
0 ms |
348 KB |
Output is correct |
80 |
Correct |
0 ms |
348 KB |
Output is correct |
81 |
Correct |
1 ms |
344 KB |
Output is correct |
82 |
Correct |
1 ms |
604 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
1 ms |
348 KB |
Output is correct |
85 |
Correct |
1 ms |
344 KB |
Output is correct |
86 |
Correct |
1 ms |
348 KB |
Output is correct |
87 |
Correct |
0 ms |
348 KB |
Output is correct |
88 |
Correct |
0 ms |
348 KB |
Output is correct |
89 |
Correct |
0 ms |
344 KB |
Output is correct |
90 |
Correct |
0 ms |
344 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
1 ms |
348 KB |
Output is correct |
93 |
Correct |
1 ms |
348 KB |
Output is correct |
94 |
Correct |
1 ms |
348 KB |
Output is correct |
95 |
Correct |
1 ms |
344 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
1 ms |
348 KB |
Output is correct |
98 |
Correct |
0 ms |
348 KB |
Output is correct |
99 |
Correct |
1 ms |
348 KB |
Output is correct |
100 |
Correct |
1 ms |
348 KB |
Output is correct |
101 |
Correct |
1 ms |
348 KB |
Output is correct |
102 |
Correct |
0 ms |
348 KB |
Output is correct |
103 |
Correct |
0 ms |
348 KB |
Output is correct |
104 |
Correct |
0 ms |
348 KB |
Output is correct |
105 |
Correct |
0 ms |
452 KB |
Output is correct |
106 |
Correct |
1 ms |
344 KB |
Output is correct |
107 |
Correct |
1 ms |
348 KB |
Output is correct |
108 |
Correct |
1 ms |
348 KB |
Output is correct |
109 |
Correct |
2 ms |
604 KB |
Output is correct |
110 |
Correct |
25 ms |
4268 KB |
Output is correct |
111 |
Correct |
50 ms |
6292 KB |
Output is correct |
112 |
Correct |
30 ms |
6488 KB |
Output is correct |
113 |
Correct |
22 ms |
6488 KB |
Output is correct |
114 |
Correct |
12 ms |
6236 KB |
Output is correct |
115 |
Correct |
12 ms |
6360 KB |
Output is correct |
116 |
Correct |
29 ms |
6236 KB |
Output is correct |
117 |
Correct |
35 ms |
6232 KB |
Output is correct |
118 |
Correct |
37 ms |
6480 KB |
Output is correct |
119 |
Correct |
370 ms |
13140 KB |
Output is correct |
120 |
Correct |
87 ms |
15696 KB |
Output is correct |
121 |
Correct |
75 ms |
15952 KB |
Output is correct |
122 |
Correct |
40 ms |
15364 KB |
Output is correct |
123 |
Correct |
37 ms |
15188 KB |
Output is correct |
124 |
Correct |
1051 ms |
46188 KB |
Output is correct |
125 |
Execution timed out |
2077 ms |
131896 KB |
Time limit exceeded |
126 |
Halted |
0 ms |
0 KB |
- |