답안 #733361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733361 2023-04-30T14:38:19 Z 1075508020060209tc 무지개나라 (APIO17_rainbow) C++14
11 / 100
18 ms 816 KB
#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++;
        }
    }
}

for(int i=A;i<=B;i++){
    for(int j=C;j<=D;j++){
        vis[i][j]=0;
    }
}

    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 16 ms 468 KB Output is correct
4 Correct 18 ms 484 KB Output is correct
5 Correct 7 ms 320 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 12 ms 412 KB Output is correct
12 Correct 10 ms 340 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 4 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Runtime error 2 ms 704 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 596 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 16 ms 468 KB Output is correct
4 Correct 18 ms 484 KB Output is correct
5 Correct 7 ms 320 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 12 ms 412 KB Output is correct
12 Correct 10 ms 340 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 4 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Runtime error 2 ms 816 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 16 ms 468 KB Output is correct
4 Correct 18 ms 484 KB Output is correct
5 Correct 7 ms 320 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 12 ms 412 KB Output is correct
12 Correct 10 ms 340 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 4 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Runtime error 2 ms 816 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -