#include "rainbow.h"
#include<bits/stdc++.h>
using namespace std;
int n;int m;int sx;int sy;
string s;
int gr[60][60];
void init(int R, int C, int sr, int sc, int M, char *S) {
n=R;m=C;
gr[sr][sc]=1;
for(int i=0;i<M;i++){
if(S[i]=='N'){sr--;}
if(S[i]=='S'){sr++;}
if(S[i]=='W'){sc--;}
if(S[i]=='E'){sc++;}
gr[sr][sc]=1;
}
}
int vis[60][60];
int dir[5]={0,1,0,-1,0};
int A;int B;int C;int D;
int ok(int x,int y){
if(x>=A&&x<=B&&y>=C&&y<=D){return 1;}
return 0;
}
void dfs(int nwx,int nwy){
vis[nwx][nwy]=1;
for(int i=0;i<4;i++){
int vx=nwx+dir[i];int vy=nwy+dir[i+1];
if(ok(vx,vy)&&vis[vx][vy]==0&&gr[vx][vy]==0){
dfs(vx,vy);
}
}
}
int colour(int ar, int ac, int br, int bc) {
A=ar;B=br;
C=ac;D=bc;
int ret=0;
for(int i=A;i<=B;i++){
for(int j=C;j<=D;j++){
if(vis[i][j]==0&&gr[i][j]==0){
dfs(i,j);
ret++;
}
}
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Runtime error |
2 ms |
724 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |