#include <bits/stdc++.h>
#include "rainbow.h"
using namespace std;
const int maxn = 60;
bool mat[maxn][maxn];
int l[] = {-1, 1, 0, 0};
int c[] = {0, 0, -1, 1};
int n, m, pi, pj, mark[maxn][maxn];
int num=0;
int li, lj, ri, rj;
void dfs(int i, int j){
for(int k=0; k<4; k++){
int i2 = i+l[k], j2 = j+c[k];
if(i2 < li || i2 > ri || j2 < lj || j2 > rj || mat[i2][j2] || mark[i2][j2]) continue;
mark[i2][j2] = mark[i][j];
dfs(i2, j2);
}
}
void init(int R, int C, int sr, int sc, int M, char *S) {
n = R, m = C;
pi = sr, pj = sc;
mat[sr][sc] = 1;
for(int i=0;i<M;i++){
if(S[i] == 'N') --sr;
else if(S[i] == 'S') ++sr;
else if(S[i] == 'W') --sc;
else if(S[i] == 'E') ++sc;
mat[sr][sc] = 1;
}
}
int colour(int ar, int ac, int br, int bc) {
num = 0;
li = ar, lj = ac, ri = br, rj = bc;
for(int i=li;i<=ri;i++){
for(int j=lj;j<=rj;j++){
mark[i][j] = 0;
}
}
for(int i=li;i<=ri;i++){
for(int j=lj;j<=rj;j++){
if(mark[i][j] || mat[i][j]) continue;
mark[i][j] = ++num;
dfs(i, j);
}
}
return num;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
488 KB |
Output is correct |
3 |
Correct |
29 ms |
816 KB |
Output is correct |
4 |
Correct |
27 ms |
816 KB |
Output is correct |
5 |
Correct |
10 ms |
816 KB |
Output is correct |
6 |
Correct |
2 ms |
816 KB |
Output is correct |
7 |
Correct |
4 ms |
816 KB |
Output is correct |
8 |
Correct |
3 ms |
816 KB |
Output is correct |
9 |
Correct |
3 ms |
816 KB |
Output is correct |
10 |
Correct |
2 ms |
816 KB |
Output is correct |
11 |
Correct |
19 ms |
816 KB |
Output is correct |
12 |
Correct |
15 ms |
816 KB |
Output is correct |
13 |
Correct |
13 ms |
816 KB |
Output is correct |
14 |
Correct |
9 ms |
816 KB |
Output is correct |
15 |
Correct |
2 ms |
816 KB |
Output is correct |
16 |
Correct |
3 ms |
816 KB |
Output is correct |
17 |
Correct |
2 ms |
816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
816 KB |
Output is correct |
2 |
Correct |
2 ms |
816 KB |
Output is correct |
3 |
Runtime error |
3 ms |
816 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
816 KB |
Output is correct |
2 |
Runtime error |
3 ms |
940 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
488 KB |
Output is correct |
3 |
Correct |
29 ms |
816 KB |
Output is correct |
4 |
Correct |
27 ms |
816 KB |
Output is correct |
5 |
Correct |
10 ms |
816 KB |
Output is correct |
6 |
Correct |
2 ms |
816 KB |
Output is correct |
7 |
Correct |
4 ms |
816 KB |
Output is correct |
8 |
Correct |
3 ms |
816 KB |
Output is correct |
9 |
Correct |
3 ms |
816 KB |
Output is correct |
10 |
Correct |
2 ms |
816 KB |
Output is correct |
11 |
Correct |
19 ms |
816 KB |
Output is correct |
12 |
Correct |
15 ms |
816 KB |
Output is correct |
13 |
Correct |
13 ms |
816 KB |
Output is correct |
14 |
Correct |
9 ms |
816 KB |
Output is correct |
15 |
Correct |
2 ms |
816 KB |
Output is correct |
16 |
Correct |
3 ms |
816 KB |
Output is correct |
17 |
Correct |
2 ms |
816 KB |
Output is correct |
18 |
Runtime error |
7 ms |
2396 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
488 KB |
Output is correct |
3 |
Correct |
29 ms |
816 KB |
Output is correct |
4 |
Correct |
27 ms |
816 KB |
Output is correct |
5 |
Correct |
10 ms |
816 KB |
Output is correct |
6 |
Correct |
2 ms |
816 KB |
Output is correct |
7 |
Correct |
4 ms |
816 KB |
Output is correct |
8 |
Correct |
3 ms |
816 KB |
Output is correct |
9 |
Correct |
3 ms |
816 KB |
Output is correct |
10 |
Correct |
2 ms |
816 KB |
Output is correct |
11 |
Correct |
19 ms |
816 KB |
Output is correct |
12 |
Correct |
15 ms |
816 KB |
Output is correct |
13 |
Correct |
13 ms |
816 KB |
Output is correct |
14 |
Correct |
9 ms |
816 KB |
Output is correct |
15 |
Correct |
2 ms |
816 KB |
Output is correct |
16 |
Correct |
3 ms |
816 KB |
Output is correct |
17 |
Correct |
2 ms |
816 KB |
Output is correct |
18 |
Runtime error |
7 ms |
2396 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Halted |
0 ms |
0 KB |
- |