Submission #208583

# Submission time Handle Problem Language Result Execution time Memory
208583 2020-03-11T17:37:30 Z MvC Land of the Rainbow Gold (APIO17_rainbow) C++11
0 / 100
8 ms 888 KB
#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,char *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 colour(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;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Runtime error 6 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -