This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |