이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "rainbow.h"
using namespace std;
int xmin, xmax, ymin, ymax;
set<pair<int, int>> vertex, edge_v, edge_h, face;
void init(int R, int C, int sr, int sc, int M, char *S){
sr--;
sc--;
vector<int> x(M + 1), y(M + 1);
x[0] = sr;
y[0] = sc;
for (int i = 0; i < M; i++){
x[i + 1] = x[i];
y[i + 1] = y[i];
if (S[i] == 'N'){
x[i + 1]--;
}
if (S[i] == 'S'){
x[i + 1]++;
}
if (S[i] == 'E'){
y[i + 1]++;
}
if (S[i] == 'W'){
y[i + 1]--;
}
}
xmin = sr;
xmax = sr;
ymin = sc;
ymax = sc;
for (int i = 1; i <= M; i++){
xmin = min(xmin, x[i]);
xmax = max(xmax, x[i]);
ymin = min(ymin, y[i]);
ymax = max(ymax, y[i]);
}
for (int i = 0; i <= M; i++){
vertex.insert(make_pair(x[i], y[i]));
edge_v.insert(make_pair(x[i], y[i]));
edge_v.insert(make_pair(x[i] - 1, y[i]));
edge_h.insert(make_pair(x[i], y[i]));
edge_h.insert(make_pair(x[i], y[i] - 1));
face.insert(make_pair(x[i], y[i]));
face.insert(make_pair(x[i] - 1, y[i]));
face.insert(make_pair(x[i], y[i] - 1));
face.insert(make_pair(x[i] - 1, y[i] - 1));
}
}
int colour(int ar, int ac, int br, int bc){
ar--;
ac--;
int ans = 1;
for (auto P : vertex){
if (ar <= P.first && P.first < br && ac <= P.second && P.second < bc){
ans--;
}
}
for (auto P : edge_v){
if (ar <= P.first && P.first < br - 1 && ac <= P.second && P.second < bc){
ans++;
}
}
for (auto P : edge_h){
if (ar <= P.first && P.first < br && ac <= P.second && P.second < bc - 1){
ans++;
}
}
for (auto P : face){
if (ar <= P.first && P.first < br - 1 && ac <= P.second && P.second < bc - 1){
ans--;
}
}
if (ar < xmin && xmax < br - 1 && ac < ymin && ymax < bc - 1){
ans++;
}
return ans;
}
# | 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... |