# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
680281 | mjhmjh1104 | Tortoise (CEOI21_tortoise) | C++17 | 200 ms | 444556 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
int n, a[500006], dist[500006], res, dp[306][606][306][2];
vector<int> playgrounds;
int pv[500006], nx[500006];
int f(int x, int y, int z, int w) {
if (y > 2 * n - 2) return 0;
if (dp[x][y][z][w] + 1) return dp[x][y][z][w];
if (w && a[x] == -1) return dp[x][y][z][w] = f(x, y, z, 0);
dp[x][y][z][w] = 0;
if (w && a[x] != -1) dp[x][y][z][w] = max(dp[x][y][z][w], f(x + 1, y - 1, min(n, max(a[x + 1], 0)), 1));
if (x < n - 1) dp[x][y][z][w] = max(dp[x][y][z][w], f(x + 1, y + 1, min(n, max(a[x + 1], 0)), 0));
if (pv[x] != -1 && z > 0 && y <= 2 * x) {
int dist = x - pv[x];
dp[x][y][z][w] = max(dp[x][y][z][w], f(x, y + 2 * dist, z - 1, 0) + 1);
}
if (nx[x] != -1 && z > 0 && y <= 2 * x) {
int dist = nx[x] - x;
dp[x][y][z][w] = max(dp[x][y][z][w], f(x, y + 2 * dist, z - 1, 1) + 1);
}
return dp[x][y][z][w];
}
int main() {
memset(dp, -1, sizeof dp);
컴파일 시 표준 에러 (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... |