Submission #733359

# Submission time Handle Problem Language Result Execution time Memory
733359 2023-04-30T14:36:47 Z 1075508020060209tc Land of the Rainbow Gold (APIO17_rainbow) C++14
Compilation error
0 ms 0 KB
#include "rainbow.h"
#include<bits/stdc++.h>
using namespace std;
int n;int m;int sx;int sy;
string s;
int gr[60][60];

void init(int R, int C, int sr, int sc, int M, char *S) {
n=R;m=C;
gr[sr][sc]=1;
for(int i=0;i<M;i++){
    if(S[i]=='N'){sr--;}
    if(S[i]=='S'){sr++;}
    if(S[i]=='W'){sc--;}
    if(S[i]=='E'){sc++;}
    gr[sr][sc]=1;
}
}

int vis[60][60];
int dir[5]={0,1,0,-1,0};
int A;int B;int C;int D;

int ok(int x,int y){
if(x>=A&&x<=B&&y>=C&&y<=D){return 1;}
return 0;
}

void dfs(int nwx,int nwy){
vis[nwx][nwy]=1;
for(int i=0;i<4;i++){
    int vx=nwx+dir[i];int vy=nwy+dir[i+1];
    if(ok(vx,vy)&&vis[vx][vy]==0&&gr[vx][vy]==0){
        dfs(vx,vy);
    }
}
}


int colour(int ar, int ac, int br, int bc) {
A=ar;B=br;
C=ac;D=bc;
int ret=0;
for(int i=A;i<=B;i++){
    for(int j=C;j<=D;j++){
        if(vis[i][j]==0&&gr[i][j]==0){
            dfs(i,j);
            ret++;
        }
    }
}
    return ret;
}


signed main(){

}

Compilation message

/usr/bin/ld: /tmp/cc04QsDX.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPNcbjT.o:rainbow.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status