답안 #904421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
904421 2024-01-12T05:01:49 Z vjudge1 무지개나라 (APIO17_rainbow) C++17
컴파일 오류
0 ms 0 KB
bool was[1001][1001];
bool c[1001][1001];
void dfs(int x,int y,int lx,int ly,int rx,int ry){
    if(x>=lx and x<=rx and y>=ly and y<=ry and !c[x][y] and !was[x][y]){
        c[x][y]=1;
        dfs(x-1,y,lx,ly,rx,ry);
        dfs(x+1,y,lx,ly,rx,ry);
        dfs(x,y-1,lx,ly,rx,ry);
        dfs(x,y+1,lx,ly,rx,ry);
    }
}
void init(int r,int c,int sr,int sc,int m,char* s){
    int px=sr,py=sc;
    was[px][py]=1;
    for(int i=0;i<m;i++){
        char u=s[i];
        if(u=='S'){
            px++;
        }else if(u=='N'){
            px--;
        }else if(u=='W'){
            py++;
        }else{
            py--;
        }
        was[px][py]=1;
    }
}
int colours(int lx,int ly,int rx,int ry){
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            c[i][j]=0;
        }
    }
    int cnt=0;
    for(int i=lx;i<=rx;i++){
        for(int j=ly;j<=ry;j++){
            if(!c[i][j]){
                dfs(i,j,lx,ly,rx,ry);
                cnt++;
            }
        }
    }
    return cnt;
}`

Compilation message

rainbow.cpp:45:2: error: stray '`' in program
   45 | }`
      |  ^