# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
328607 | dolphingarlic | Nafta (COI15_nafta) | C++14 | 532 ms | 121192 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int n, m;
char grid[2001][2001];
bool visited[2001][2001];
int dx[4]{1, -1, 0, 0}, dy[4]{0, 0, 1, -1};
int bit[2001], diff[2001][2001], dp[2001][2001];
bool inside(int x, int y) {
return x && y && x <= n && y <= m && !visited[x][y] && grid[x][y] != '.';
}
tuple<int, int, int> get_oil(int x, int y) {
tuple<int, int, int> ret = {y, y, grid[x][y] - '0'};
visited[x][y] = true;
for (int i = 0; i < 4; i++) if (inside(x + dx[i], y + dy[i])) {
tuple<int, int, int> pot = get_oil(x + dx[i], y + dy[i]);
get<0>(ret) = min(get<0>(ret), get<0>(pot));
get<1>(ret) = max(get<1>(ret), get<1>(pot));
get<2>(ret) += get<2>(pot);
}
return ret;
}
void update(int pos, int val) { for (; pos <= m; pos += pos & -pos) bit[pos] += val; }
int query(int pos) {
int ans = 0;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |