Submission #578504

# Submission time Handle Problem Language Result Execution time Memory
578504 2022-06-17T06:38:25 Z jiahng Land of the Rainbow Gold (APIO17_rainbow) C++14
0 / 100
3000 ms 36232 KB
#include "rainbow.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
// #define ll int
//#define int ll
typedef pair<int32_t, int32_t> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
typedef pair<pi, ll> pii;
typedef set <ll> si;
typedef long double ld;
#define f first
#define s second
#define mp make_pair
#define FOR(i,s,e) for(int i=s;i<=int(e);++i)
#define DEC(i,s,e) for(int i=s;i>=int(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define maxn 120001
#define INF 1e9
#define MOD 1000000007
typedef pair <vi, int> pvi;
typedef pair <int,pi> ipi;
typedef vector <pii> vpii;
int R,C;
bool boundary(pi pos){
    return (pos.f == 1 || pos.f == R || pos.s == 1 || pos.s == C);
}
set <pi> st;
void init(int R, int C, int sr, int sc, int M, char *S) {
    ::R = R; ::C = C;
    int x=sr,y=sc;
    st.insert(pi(x,y));
    FOR(i,0,M-1){
        if (S[i] == 'S') x++;
        else if (S[i] == 'N') x--;
        else if (S[i] == 'E') y++;
        else if (S[i] == 'W') y--;
        st.insert(pi(x,y));
    } 
}

int colour(int ar, int ac, int br, int bc) {
    set <pi> st2;
    aFOR(i,st) if (ar <= i.f && i.f <= br && ac <= i.s && i.s <= bc){
        st2.insert(i);
    }
    FOR(i,ac-1,bc+1){
        st2.insert(pi(ar-1,i));
        st2.insert(pi(br+1,i));
    }
    FOR(i,ar-1,br+1){
        st2.insert(pi(i,ac-1));
        st2.insert(pi(i,bc+1));
    }
    //aFOR(i,st2) cout << i.f << ' ' << i.s << '\n';

    int edgenum = 0;
    aFOR(i,st2){
        if (st2.find(pi(i.f-1,i.s)) != st2.end()) edgenum++;
        if (st2.find(pi(i.f,i.s-1)) != st2.end()) edgenum++;
    }
    int faces = edgenum - (int)st2.size() + 1;

    aFOR(i,st2){
        bool no = 0;
        FOR(dx,-1,0) FOR(dy,-1,0) if (st2.find(pi(i.f+dx,i.s+dy)) == st2.end()) no = 1;
       if (!no) faces--;
    }
   return faces; 
}
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Execution timed out 3066 ms 22980 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 279 ms 21616 KB Output is correct
3 Correct 244 ms 21612 KB Output is correct
4 Correct 223 ms 19368 KB Output is correct
5 Correct 107 ms 11432 KB Output is correct
6 Correct 430 ms 24904 KB Output is correct
7 Incorrect 599 ms 36232 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -