#include "rainbow.h"
#include <bits/stdc++.h>
using namespace std;
#define all(aaa) aaa.begin(), aaa.end()
string dir = "NSEW";
const int dx[4] = {-1, 1, 0, 0},
dy[4] = {0, 0, 1, -1};
const int N = 52;
int a[N][N];
void init(int R, int C, int sr, int sc, int M, char *S) {
a[sr][sc] = 1;
int x = sr, y = sc;
for (int i = 0; i < M; i++) {
int k = find(all(dir), S[i]) - dir.begin();
x += dx[k];
y += dy[k];
a[x][y] = 1;
}
// for (int i = 1; i <= R; i++) {
// for (int j = 1; j <= C; j++) {
// cout << a[i][j];
// }
// cout << "\n";
// }
}
int colour(int ar, int ac, int br, int bc) {
int ans = 1;
for (int i = ar + 1; i < br; i++) {
for (int j = ac; j < bc; j++) {
ans += (a[i][j] && a[i][j + 1]);
}
}
for (int i = ar; i < br; i++) {
for (int j = ac + 1; j < bc; j++) {
ans += (a[i + 1][j] && a[i][j]);
}
}
for (int i = ar; i <= br; i++) {
for (int j = ac; j <= bc; j++) {
ans -= a[i][j];
}
}
for (int i = ar; i <= br; i++) {
ans += a[i][ac] + a[i][bc];
}
for (int i = ac; i <= bc; i++) {
ans += a[ar][i] + a[br][i];
}
for (int i = ar; i < br; i++) {
for (int j = ac; j < bc; j++) {
ans -= (a[i][j] && a[i + 1][j] &&
a[i][j + 1] && a[i + 1][j + 1]);
}
}
ans -= a[ar][ac] + a[ar][bc] + a[br][ac] + a[br][bc];
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
3 ms |
760 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |