// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()
#include<bits/stdc++.h>
#include "rainbow.h"
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> pii;
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int MAXN = (int)1e3 + 5;
const int MAXM = (int)1e5 + 5;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const char dc[] = {'E', 'S', 'W', 'N'};
int col[MAXN][MAXN];
pii arr[MAXN];
char str[MAXN];
int n, m, k;
int stx, sty;
void init(int R, int C, int sr, int sc, int M, char *S) {
n = R;
m = C;
stx = sr;
sty = sc;
k = M;
for (int i = 0; i < k; ++i) {
str[i] = S[i];
}
arr[0] = mp(stx, sty);
for (int i = 0; i < k; ++i) {
int idx = find(dc, dc + 4, str[i]) - dc;
stx += dx[idx];
sty += dy[idx];
arr[i + 1] = mp(stx, sty);
}
for (int i = 0; i <= k; ++i) {
int x, y;
tie(x, y) = arr[i];
col[x][y] = 1;
}
}
int colour(int ax, int ay, int bx, int by) {
set<pii> ver;
for (int i = ax; i <= bx + 1; ++i) {
ver.insert(mp(i, ay));
ver.insert(mp(i, by + 1));
}
for (int i = ay; i <= by + 1; ++i) {
ver.insert(mp(ax, i));
ver.insert(mp(bx + 1, i));
}
int e = (bx - ax + 1) * 2 + (by - ay + 1) * 2;
bool saw = 0;
for (int x = ax; x <= bx; ++x) {
for (int y = ay; y <= by; ++y) {
if (col[x][y] == 1) {
saw = 1;
ver.insert(mp(x, y));
ver.insert(mp(x + 1, y));
ver.insert(mp(x + 1, y + 1));
ver.insert(mp(x, y + 1));
e += 4;
for (int d = 0; d < 4; ++d) {
int nx = x + dx[d];
int ny = y + dy[d];
if (nx < ax || nx > bx || ny < ay || ny > by || col[nx][ny]) {
--e;
}
}
}
}
}
return e - (int)ver.size() + (saw == 0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Execution timed out |
3046 ms |
19248 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Runtime error |
8 ms |
2296 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |