Submission #743285

# Submission time Handle Problem Language Result Execution time Memory
743285 2023-05-17T09:29:44 Z vjudge1 Land of the Rainbow Gold (APIO17_rainbow) C++17
11 / 100
20 ms 852 KB
#include <bits/stdc++.h>

#include "rainbow.h"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"

const int maxn = 1e6 + 100;
const ll INF = (1ll<<61);
const int MOD = 1e9 + 7;
const int inf = (1<<30);
const int maxl = 20;
const int P = 31;

int n, m;
int used[55][55];
int u[55][55];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

void dfs(int x, int y, int l1, int r1, int l2, int r2){
    if(used[x][y] || u[x][y] || x < l1 || x > r1 || y < l2 || y > r2) return;
    u[x][y] = 1;
    for(int i = 0; i < 4; i++){
        dfs(x + dx[i], y + dy[i], l1, r1, l2, r2);
    }
}

void init(int r, int c, int x, int y, int p, char s[]){
    n = r; m = c;
    used[x][y] = 1;
    for(int i = 0; i < p; i++){
        if(s[i] == 'N') x--;
        else if(s[i] == 'W') y--;
        else if(s[i] == 'E') y++;
        else x++;
        used[x][y] = 1;
    }
}

int colour(int l1, int l2, int r1, int r2){
    for(int i = l1; i <= r1; i++){
        fill(u[i] + l2, u[i] + r2 + 1, 0);
    }
    int ans = 0;
    for(int i = l1; i <= r1; i++){
        for(int j = l2; j <= r2; j++){
            if(!used[i][j] && !u[i][j]) dfs(i, j, l1, r1, l2, r2), ans++;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 20 ms 520 KB Output is correct
4 Correct 19 ms 468 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 16 ms 500 KB Output is correct
12 Correct 13 ms 468 KB Output is correct
13 Correct 9 ms 432 KB Output is correct
14 Correct 6 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Runtime error 1 ms 852 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 724 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 20 ms 520 KB Output is correct
4 Correct 19 ms 468 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 16 ms 500 KB Output is correct
12 Correct 13 ms 468 KB Output is correct
13 Correct 9 ms 432 KB Output is correct
14 Correct 6 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 312 KB Output is correct
18 Runtime error 1 ms 828 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 20 ms 520 KB Output is correct
4 Correct 19 ms 468 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 16 ms 500 KB Output is correct
12 Correct 13 ms 468 KB Output is correct
13 Correct 9 ms 432 KB Output is correct
14 Correct 6 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 312 KB Output is correct
18 Runtime error 1 ms 828 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -