# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
408612 | syl123456 | 무지개나라 (APIO17_rainbow) | C++17 | 3058 ms | 1048580 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rainbow.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<bool>> b;
vector<int> p;
int m;
void init(int R, int C, int sr, int sc, int M, char *S) {
m = C;
b.assign(R, vector<bool>(C, false));
p.resize(R * C);
--sr, --sc;
b[sr][sc] = true;
for (int i = 0; i < M; ++i) {
if (S[i] == 'N') --sr;
else if (S[i] == 'S') ++sr;
else if (S[i] == 'W') --sc;
else ++sc;
b[sr][sc] = true;
}
}
int colour(int ar, int ac, int br, int bc) {
--ar, --ac;
int _ = 0;
for (int i = ar; i < br; ++i) for (int j = ac; j < bc; ++j)
p[i * m + j] = i * m + j;
function<int(int)> find = [&](int i) {
return p[i] = p[i] == i ? i : find(p[i]);
};
for (int i = ar; i < br; ++i) for (int j = ac; j < bc; ++j) if (!b[i][j]) {
if (i < br - 1 && !b[i + 1][j])
p[find(i * m + j)] = find((i + 1) * m + j);
if (j < bc - 1 && !b[i][j + 1])
p[find(i * m + j)] = find(i * m + j + 1);
}
int ans = 0;
for (int i = ar; i < br; ++i) for (int j = ac; j < bc; ++j) if (!b[i][j])
ans += find(i * m + j) == i * m + j;
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |