Submission #578504

#TimeUsernameProblemLanguageResultExecution timeMemory
578504jiahng무지개나라 (APIO17_rainbow)C++14
0 / 100
3066 ms36232 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...