Submission #743282

# Submission time Handle Problem Language Result Execution time Memory
743282 2023-05-17T09:28:10 Z vjudge1 Land of the Rainbow Gold (APIO17_rainbow) C++17
Compilation error
0 ms 0 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, string 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;
}

Compilation message

/usr/bin/ld: /tmp/ccPRjAls.o: in function `main':
grader.cpp:(.text.startup+0xed): undefined reference to `init(int, int, int, int, int, char*)'
collect2: error: ld returned 1 exit status