Submission #264129

# Submission time Handle Problem Language Result Execution time Memory
264129 2020-08-14T05:13:27 Z define Land of the Rainbow Gold (APIO17_rainbow) C++17
11 / 100
3000 ms 6912 KB
#include "rainbow.h"
#include<bits/stdc++.h>
using namespace std;

bool used[55][55];
void init(int R, int C, int sr, int sc, int M, char *S) {
    string T=string(S);
    used[sr][sc]=true;
    for(char c:T){
        if(c=='N')sr--;
        else if(c=='S')sr++;
        else if(c=='W')sc--;
        else sc++;
        used[sr][sc]=true;
    }
}
bool memo[55][55];
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
void dfs(int x,int y,int ar,int ac,int br,int bc){
    memo[x][y]=true;
    for(int i=0;i<4;i++){
        int nx=x+dx[i],ny=y+dy[i];
        if(nx<ar||nx>br||ny<ac||ny>bc||used[nx][ny])continue;
        if(!memo[nx][ny])dfs(nx,ny,ar,ac,br,bc);
    }
}
int colour(int ar, int ac, int br, int bc) {
    int ans=0;
    memset(memo,0,sizeof(memo));
    for(int i=ar;i<=br;i++){
        for(int j=ac;j<=bc;j++){
            if(!memo[i][j]&&!used[i][j]){
                ans++;
                dfs(i,j,ar,ac,br,bc);
            }
        }
    }
    return ans;
}

# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 15 ms 512 KB Output is correct
4 Correct 15 ms 512 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 13 ms 512 KB Output is correct
12 Correct 17 ms 512 KB Output is correct
13 Correct 10 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Runtime error 8 ms 6912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 15 ms 512 KB Output is correct
4 Correct 15 ms 512 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 13 ms 512 KB Output is correct
12 Correct 17 ms 512 KB Output is correct
13 Correct 10 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Execution timed out 3068 ms 2704 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 15 ms 512 KB Output is correct
4 Correct 15 ms 512 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 13 ms 512 KB Output is correct
12 Correct 17 ms 512 KB Output is correct
13 Correct 10 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Execution timed out 3068 ms 2704 KB Time limit exceeded
19 Halted 0 ms 0 KB -