Submission #904411

# Submission time Handle Problem Language Result Execution time Memory
904411 2024-01-12T04:57:15 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,string s){
    int px=sr,py=sc;
    was[px][py]=1;
    for(auto u:s){
        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:12:43: error: 'string' has not been declared
   12 | void init(int r,int c,int sr,int sc,int m,string s){
      |                                           ^~~~~~
rainbow.cpp: In function 'void init(int, int, int, int, int, int)':
rainbow.cpp:15:16: error: 'begin' was not declared in this scope
   15 |     for(auto u:s){
      |                ^
rainbow.cpp:15:16: error: 'end' was not declared in this scope