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;
vector<vector<char>> grid;
void init(int R, int C, int sr, int sc, int M, char *S) {
vector<char> auxi(C,' ');
for(int i=0;i<R;i++){
grid.push_back(auxi);
}
sr--;
sc--;
grid[sr][sc]='x';
for(int i=0;i<M;i++){
switch(S[i]){
case 'N':
sr--;
break;
case 'S':
sr++;
break;
case 'W':
sc--;
break;
case 'E':
sc++;
break;
}
grid[sr][sc]='x';
}
}
int colour(int ar, int ac, int br, int bc) {
int canti=0;
ar--;
ac--;
br--;
bc--;
vector<vector<char>> clon(grid.begin(),grid.end());
for(int i=ar;i<=br;i++){
bool xd=true;
for(int j=ac;j<=bc;j++){
if(clon[i][j]==' ' && xd){
canti++;
xd=false;
}else{
xd=true;
}
}
}
if(ar==0 && br==1){
if(canti==2){
if(clon[ar][ac]==clon[br][ac] || clon[ar][bc]==clon[br][bc]){
return 1;
}
}
if(clon[ar][ac]==clon[br][ac] && clon[ar][ac]==' '){
canti--;
}
if(clon[ar][bc]==clon[br][bc] && clon[ar][bc]==' '){
canti--;
}
}
return canti;
}
# | 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... |