Submission #208598

# Submission time Handle Problem Language Result Execution time Memory
208598 2020-03-11T18:06:35 Z MvC Land of the Rainbow Gold (APIO17_rainbow) C++11
0 / 100
9 ms 628 KB
    #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,lx,ly,ux,uy,k;
    void init(int R,int C,int sx,int sy,int M,char *s)
    {
    	h=R,w=C,m=M;
    	for(int 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;
    	for(int i=-1;i<=1;i++)for(int j=-1;j<=1;j++)if(i || j)dfs(x+i,y+j);
    }
    int colour(int Lx,int Ly,int Ux,int Uy)
    {
    	lx=Lx,ly=Ly,ux=Ux,uy=Uy;
    	int i,j,k=0;
    	for(i=1;i<=h;i++)for(j=1;j<=w;j++)tmp[i][j]=viz[i][j];
    	for(i=lx;i<=ux;i++)
    	{
    		for(j=ly;j<=uy;j++)
    		{
    			if(tmp[i][j])continue;
    			dfs(i,j);
    			k++;
    		}
    	}
    	return k;
    }
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 376 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 4 ms 376 KB Output is correct
2 Runtime error 7 ms 628 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 9 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -