# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
313709 | Temmie | Furniture (JOI20_furniture) | C++17 | 416 ms | 24032 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
void place(int X, int Y, std::queue <std::pair <int, int>>& q, std::vector <int>& le, std::vector <int>& ri, std::vector <std::vector <int>>& g, std::vector <std::vector <int>>& ou, std::vector <std::vector <int>>& in, int n, int m) {
q.push({ X, Y });
while (q.size()) {
auto p = q.front(); q.pop();
int x = p.first, y = p.second;
if (g[x][y]) continue;
g[x][y] = 1;
if (x && !--ou[x - 1][y]) q.push({ x - 1, y });
if (y && !--ou[x][y - 1]) q.push({ x, y - 1 });
if (x + 1 < n && !--in[x + 1][y]) q.push({ x + 1, y });
if (y + 1 < m && !--in[x][y + 1]) q.push({ x, y + 1 });
while (le[x + y] == x && g[x][y]) le[x + y]++, x++, y--;
while (ri[x + y] == x && g[x][y]) ri[x + y]--, x--, y++;
}
}
int main() {
std::ios::sync_with_stdio(0); std::cin.tie(0);
int n, m; std::cin >> n >> m;
std::vector <std::vector <int>> g(n, std::vector <int> (m)), ou(g), in(g);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (j + 1 < m) ou[i][j]++, in[i][j + 1]++;
if (i + 1 < n) ou[i][j]++, in[i + 1][j]++;
}
}
std::vector <int> le(n + m, n), ri(n + m, 0);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |