#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(grid[i][j]==' ' && xd){
canti++;
xd=false;
}else{
xd=true;
}
}
}
if(ar==0 && br==1){
if(canti==2){
if(grid[ar][ac]==grid[br][ac] || grid[ar][bc]==grid[br][bc]){
return 1;
}
}
if(grid[ar][ac]==grid[br][ac] && grid[ar][ac]==' '){
canti--;
}
if(grid[ar][bc]==grid[br][bc] && grid[ar][bc]==' '){
canti--;
}
}
return canti;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
3096 ms |
2160 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
444 KB |
Output is correct |
2 |
Runtime error |
441 ms |
1048576 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |