#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include "rainbow.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e2+50;
const int mod=1e9+7;
using namespace std;
int h,w,tmp[nmax][nmax],viz[nmax][nmax],m,i,j,lx,ly,ux,uy,k;
string s;
void init(int R,int C,int sx,int sy,int M,string S)
{
h=R,w=C,m=M,s=S;
for(i=0;i<=m;i++)
{
viz[sx][sy]=1;
if(i==m)break;
if(s[i]=='S')sx--;
else if(s[i]=='N')sx++;
else if(s[i]=='E')sy++;
else if(s[i]=='W')sy--;
}
}
bool ok(int x,int y)
{
if(x<lx || x>ux || y<ly || y>uy || tmp[x][y])return 0;
return 1;
}
void dfs(int x,int y)
{
if(!ok(x,y))return;
tmp[x][y]=1;
dfs(x+1,y);
dfs(x-1,y);
dfs(x,y+1);
dfs(x,y-1);
}
int colours(int Lx,int Ly,int Ux,int Uy)
{
lx=Lx,ly=Ly,ux=Ux,uy=Uy;
for(i=1;i<=h;i++)for(j=1;j<=w;j++)tmp[i][j]=viz[i][j];
k=0;
for(i=lx;i<=ux;i++)
{
for(j=ly;j<=uy;j++)
{
if(tmp[i][j])continue;
dfs(i,j);
k++;
}
}
return k;
}
/*int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
return 0;
}*/
Compilation message
/tmp/ccbynU7h.o: In function `main':
grader.cpp:(.text.startup+0xcc): undefined reference to `init(int, int, int, int, int, char*)'
grader.cpp:(.text.startup+0x131): undefined reference to `colour(int, int, int, int)'
collect2: error: ld returned 1 exit status