Submission #904448

# Submission time Handle Problem Language Result Execution time Memory
904448 2024-01-12T05:17:18 Z vjudge1 Land of the Rainbow Gold (APIO17_rainbow) C++17
11 / 100
3000 ms 8872 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]){
        if(lx==1 and ly==2 and rx==5 and ry==3){
            // cout<<x<<' '<<y<<endl;
        }
        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=='E'){
            py++;
        }else{
            py--;
        }
        // cout<<px<<' '<<py<<endl;
        was[px][py]=1;
    }
}
int colour(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(i==3 and j==2){
            }
            if(!c[i][j] and !was[i][j]){
                dfs(i,j,lx,ly,rx,ry);
                cnt++;
            }
        }
    }
    return cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 15 ms 768 KB Output is correct
4 Correct 15 ms 604 KB Output is correct
5 Correct 7 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 12 ms 604 KB Output is correct
12 Correct 10 ms 604 KB Output is correct
13 Correct 7 ms 644 KB Output is correct
14 Correct 5 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Execution timed out 3023 ms 1396 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 15 ms 768 KB Output is correct
4 Correct 15 ms 604 KB Output is correct
5 Correct 7 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 12 ms 604 KB Output is correct
12 Correct 10 ms 604 KB Output is correct
13 Correct 7 ms 644 KB Output is correct
14 Correct 5 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Execution timed out 3046 ms 8872 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 15 ms 768 KB Output is correct
4 Correct 15 ms 604 KB Output is correct
5 Correct 7 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 12 ms 604 KB Output is correct
12 Correct 10 ms 604 KB Output is correct
13 Correct 7 ms 644 KB Output is correct
14 Correct 5 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Execution timed out 3046 ms 8872 KB Time limit exceeded
19 Halted 0 ms 0 KB -