Submission #252957

# Submission time Handle Problem Language Result Execution time Memory
252957 2020-07-26T14:21:30 Z orgiooo Land of the Rainbow Gold (APIO17_rainbow) C++14
0 / 100
3000 ms 512 KB
#include <bits/stdc++.h>
#include <rainbow.h>
#define ll long long
#define pb push_back
#define ret return 0
#define con continue
#define db double
#define gcd __gcd
#define freopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
using namespace std;
ll n,m,ans,t,cnt,x,y,z,u;
ll i,j,r,l,k;
ll a[123],b[123],d[123],e[123];
map <ll,ll> f;
set<pair<ll,ll>> s;
set<int>::iterator it;
vector <ll> c[123];
string p[200],q,w[200];
ll lcm(ll x,ll y){
    ll z=gcd(x,y);
    return x*y/z;
}
void init(int R, int C, int sr, int sc, int M, char *S) {
    n=R;m=C;x=sr;y=sc;k=M;
    x--;y--;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            w[i][j]='0';
        }
    }
    w[x][y]='1';
    for(i=0;i<k;i++){
        if (q[i]=='W'){
            y--;
        }
        if (q[i]=='E'){
            y++;
        }
        if (q[i]=='N'){
            x--;
        }
        if (q[i]=='S'){
            x++;
        }
        w[x][y]='1';
    }
    return;
}
int colour(int ar, int ac, int br, int bc) {
    ll x1 = ar;
    ll y1 = ac;
    ll x2 = br;
    ll y2 = bc;
    x1--;y1--;x2--;y2--;
    for(i=x1;i<=x2;i++){
        for(j=y1;j<=y2;j++){
            p[i-x1][j-y1]=w[i][j];
        }
    }
    x=x2-x1;y=y2-y1;x++;y++;
    cnt=0 ;
    for (i=0;i<x;i++){
        for(j=0;j<y;j++){
            if (p[i][j]=='0'){
                cnt ++ ;
            }
        }
    }
    l=1;
    while (cnt>0){
        ll ss =0 ;
        for (i=0;i<x;i++){
            for(j=0;j<y;j++){
                if (p[i][j]>49){
                    if (i+1<x&&p[i+1][j]=='0'){
                        ss++;
                        p[i+1][j]=p[i][j];
                    }
                    if (j+1<y&&p[i][j+1]=='0'){
                        ss++;
                        p[i][j+1]=p[i][j];
                    }
                    if (i-1>=0&&p[i-1][j]=='0'){
                        ss++;
                        p[i-1][j]=p[i][j];
                    }
                    if (j-1>=0&&p[i][j-1]=='0'){
                        ss++;
                        p[i][j-1]=p[i][j];
                    }
                }
            }
            
        }
        if (ss==0){
            l++;
            for (i=0;i<x;i++){
                ll kk =0;
                for(j=0;j<y;j++){
                    if (p[i][j]=='0'){
                        p[i][j]=char(l+48);
                        kk++;break;
                    }
                }
                if (kk>0){
                    break;
                }
            }
        }
        cnt=0;
        for (i=0;i<x;i++){
            for(j=0;j<y;j++){
                if (p[i][j]=='0'){
                    cnt ++ ;
                }
            }
        }
        
    }
    return l-2+1;
 }
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Execution timed out 3059 ms 384 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -