Submission #984039

# Submission time Handle Problem Language Result Execution time Memory
984039 2024-05-16T09:30:07 Z Unforgettablepl Land of the Rainbow Gold (APIO17_rainbow) C++17
11 / 100
14 ms 860 KB
#include <bits/stdc++.h>
using namespace std;

//#define int long long

bool water[51][51];
bool vis[51][51];
int minx,miny,maxx,maxy;

void dfs(int x,int y){
    if(x<minx or y<miny or x>maxx or y>maxy or vis[x][y] or water[x][y])return;
    vis[x][y]=true;
    dfs(x-1,y);
    dfs(x,y-1);
    dfs(x+1,y);
    dfs(x,y+1);
}

void init(int32_t R, int32_t C, int32_t sr, int32_t sc, int32_t M, char *S) {
    water[sr][sc]=true;
    for(int i=0;i<M;i++){
        if(S[i]=='N')sr--;
        else if(S[i]=='S')sr++;
        else if(S[i]=='E')sc++;
        else if(S[i]=='W')sc--;
        water[sr][sc]=true;
    }
}

int32_t colour(int32_t ar, int32_t ac, int32_t br, int32_t bc) {
    minx = ar;
    miny = ac;
    maxx = br;
    maxy = bc;
    int ans = 0;
    for(auto&i:vis)for(bool&j:i)j=false;
    for(int x=ar;x<=br;x++)for(int y=ac;y<=bc;y++)if(!vis[x][y] and !water[x][y]){ans++;dfs(x,y);}
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 5 ms 484 KB Output is correct
3 Correct 14 ms 600 KB Output is correct
4 Correct 13 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 11 ms 348 KB Output is correct
12 Correct 9 ms 536 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 436 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 436 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 2 ms 860 KB Execution killed with signal 11
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 600 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 5 ms 484 KB Output is correct
3 Correct 14 ms 600 KB Output is correct
4 Correct 13 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 11 ms 348 KB Output is correct
12 Correct 9 ms 536 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 436 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Runtime error 1 ms 856 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 5 ms 484 KB Output is correct
3 Correct 14 ms 600 KB Output is correct
4 Correct 13 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 11 ms 348 KB Output is correct
12 Correct 9 ms 536 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 436 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Runtime error 1 ms 856 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -