Submission #1117100

#TimeUsernameProblemLanguageResultExecution timeMemory
1117100gustavo_dLand of the Rainbow Gold (APIO17_rainbow)C++17
0 / 100
2 ms764 KiB
#include "rainbow.h" #include <bits/stdc++.h> using namespace std; map<char, pair<int, int>> ds; bool mark[51][51]; void init(int R, int C, int sr, int sc, int M, char *S) { ds['N'] = {-1, 0}; ds['S'] = {1, 0}; ds['E'] = {0, 1}; ds['W'] = {0, -1}; for (int i=0; i<=50; i++) mark[i][0] = true; for (int i=0; i<=50; i++) mark[0][i] = true; mark[sr][sc] = true; // cout << sr << ' ' << sc << endl; for (int i=0; i<M; i++) { char c = S[i]; sr += ds[c].first; sc += ds[c].second; mark[sr][sc] = true; // cout << sr << ' ' << sc << endl; } } int colour(int ar, int ac, int br, int bc) { int cnt = 0; for (int r=ar; r<=br; r++) { for (int c=ac; c<=bc; c++) { if (!mark[r][c] and (mark[r][c-1] or c == ac) and (mark[r-1][c] or r == ar)) { cnt++; // cout << r << ' ' << c << endl; } } } return cnt; }
#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...