# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
437689 | gromperen | 던전 (IOI21_dungeons) | C++17 | 129 ms | 11000 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dungeons.h"
#include <bits/stdc++.h>
#define benutzen using
#define namensraum namespace
#define üblich std
#define ll long long
#define next nextcompile
benutzen namensraum üblich;
const int MAXN = 400005;
const int MAXM = 30;
const ll INF = 1e18+42069;
int next[10][MAXM][MAXN];
ll dp[10][MAXM][MAXN];
// int down[20][MAXN];
vector<int> v, s, p, w, l;
set<int> sv;
int n;
void init(int _n, std::vector<int> _s, std::vector<int> _p, std::vector<int> _w, std::vector<int> _l) {
n = _n; s = _s; p = _p; w = _w; l = _l;
// MAKE SO IT LOOPS INFINETELY AT N
s.push_back(0);
p.push_back(0);
w.push_back(n);
l.push_back(n);
for (int i = 0; i < n; ++i) {
sv.insert(s[i]);
}
v.push_back(0);
for (auto &i : sv) {
v.push_back(i);
}
for (int k = 0; k < v.size(); ++k) {
//cout << v[k] << endl;
for (int i = 0; i <= n; ++i) {
if (s[i] <= v[k]) {
next[k][0][i] = w[i];
dp[k][0][i] = s[i];
} else {
next[k][0][i] = l[i];
dp[k][0][i] = p[i];
}
}
for (int q = 1; q < MAXM; ++q) {
for (int i = 0; i <= n; ++i) {
next[k][q][i] = next[k][q-1][ next[k][q-1][i] ];
dp[k][q][i] = dp[k][q-1][i] + dp[k][q-1][ dp[k][q-1][i] ];
}
}
}
//cout <<"....." <<next[0][0][n] << endl;
return;
}
long long simulate(int x, int z) {
ll ans = z;
for (int i = 0; i < v.size() && x != n; ++i) {
ll mx = INF;
if (i < v.size() - 1) {
mx = v[i + 1];
}
//cout << "V: "<< v[i] << endl;
if (ans >= mx) {
//cout << "MX: "<< mx << endl;
continue;
}
for (int k = MAXM-1; k >= 0; --k) {
if (ans + dp[i][k][x] < mx) {
ans += dp[i][k][x];
x = next[i][k][x];
//cout << x << ": " <<ans << endl;
}
}
ans += dp[i][0][x];
x = next[i][0][x];
//cout << x << ": " <<ans << endl;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |