Submission #172861

#TimeUsernameProblemLanguageResultExecution timeMemory
172861dndhkLand of the Rainbow Gold (APIO17_rainbow)C++14
0 / 100
22 ms1648 KiB
#include "rainbow.h" #include <bits/stdc++.h> #define all(v) (v).begin(), (v).end() #define sortv(v) sort(all(v)) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define pb push_back #define FI first #define SE second #define lb lower_bound #define ub upper_bound #define mp make_pair #define test 1 #define TEST if(test) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; const int MOD = 1000000007; // 998244353 const int INF = 2e9; const ll INFLL = 1e18; const int MAX_N1 = 50; vector<pii> stage; int N, M; bool chk[MAX_N1+1][MAX_N1+1]; int type; bool vst[MAX_N1+1][MAX_N1+1]; pii s, e; void pro1(){ type = 1; for(int i=0; i<stage.size(); i++){ chk[stage[i].first][stage[i].second] = true; } } int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1}; void dfs(int x, int y){ if(x<s.first || x>e.first || y<s.second || y>e.second) return; if(chk[x][y] || vst[x][y]) return; vst[x][y] = true; for(int i=0; i<4; i++){ dfs(x+dx[i], y+dy[i]); } } void pro2(){ type = 2; } void pro3(){ type = 3; } void init(int R, int C, int sr, int sc, int l, char *S) { N = R; M = C; stage.pb({sr, sc}); for(int i=0; i<l; i++){ if(S[i]=='N'){ sr--; }else if(S[i]=='E'){ sc++; }else if(S[i]=='W'){ sc--; }else{ sr++; } stage.pb({sr, sc}); } if(R==2){ pro2(); }else if(R<=50 && C<=50){ pro1(); }else{ pro3(); } } int colour(int ar, int ac, int br, int bc) { if(type==1){ int ans = 0; s = {ar, ac}; e = {br, bc}; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ vst[i][j] = false; } } for(int i=ar; i<=br; i++){ for(int j=ac; j<=bc; j++){ if(!vst[i][j] && !chk[i][j]){ dfs(i, j); ans++; } } } return ans; } return 0; }

Compilation message (stderr)

rainbow.cpp: In function 'void pro1()':
rainbow.cpp:40:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<stage.size(); i++){
               ~^~~~~~~~~~~~~
#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...