Submission #904422

# Submission time Handle Problem Language Result Execution time Memory
904422 2024-01-12T05:02:01 Z vjudge1 Land of the Rainbow Gold (APIO17_rainbow) C++17
Compilation error
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

/usr/bin/ld: /tmp/ccGHW0da.o: in function `main':
grader.cpp:(.text.startup+0x167): undefined reference to `colour(int, int, int, int)'
collect2: error: ld returned 1 exit status