Submission #923940

#TimeUsernameProblemLanguageResultExecution timeMemory
923940irmuunLand of the Rainbow Gold (APIO17_rainbow)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "rainbow.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() bool used[51][51],water[51][51]; vector<int>dx={1,-1,0,0}; vector<int>dy={0,0,1,-1}; int r1,r2,c1,c2; bool check(int x,int y){ if(x<r1||x>r2||y<c1||y>c2) return false; return true; } void dfs(int x,int y){ if(!check(x,y)||water[x][y]==true||used[x][y]==true) return; used[x][y]=true; for(int i=0;i<4;i++){ dfs(x+dx[i],y+dy[i]); } } void init(int R,int C,int sr,int sc,int M,string S){ water[sr][sc]=true; 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++; water[sr][sc]=true; } } int colours(int ar,int ac,int br,int bc){ r1=ar; r2=br; c1=ac; c2=bc; memset(used,0,sizeof used); int ans=0; for(int i=ar;i<=br;i++){ for(int j=ac;j<=bc;j++){ if(!used[i][j]&&water[i][j]==false){ ans++; dfs(i,j); } } } return ans; }

Compilation message (stderr)

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