이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dungeons.h"
#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)
using namespace std;
#define ll long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
#ifdef wiwihorz
#define print(a...) cerr << "Line " << __LINE__ << ": ", kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
void kout() {cerr << endl;}
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
int N, lg;
vector<vector<int>> to, cost, need;
vector<int> S, P, W, L;
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
N = n, lg = 31 - __builtin_clz(n);
S = s, P = p, W = w, L = l;
to.assign(lg + 1, vector<int>(n + 1, n));
cost.assign(lg + 1, vector<int>(n + 1, 0));
need.assign(lg + 1, vector<int>(n + 1, 0));
rep(i, 0, n - 1) {
to[0][i] = w[i];
cost[0][i] = s[i];
need[0][i] = s[i];
}
rep(i, 1, lg) rep(j, 0, n) {
to[i][j] = to[i - 1][to[i - 1][j]];
cost[i][j] = cost[i - 1][j] + cost[i - 1][to[i - 1][j]];
need[i][j] = max(need[i - 1][j], need[i - 1][to[i - 1][j]] - cost[i - 1][j]);
}
return;
}
pair<int, ll> go(int x, int z) {
rrep(i, 0, lg) {
if(need[i][x] <= z) {
z = z + cost[i][x];
x = to[i][x];
}
}
return {x, z};
}
ll simulate(int x, int z) {
ll cc = z;
while(x != N) {
tie(x, cc) = go(x, cc);
if(x != N) cc += P[x], x = L[x];
}
return cc;
}
컴파일 시 표준 에러 (stderr) 메시지
dungeons.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
5 | #pragma loop-opt(on)
|
dungeons.cpp:25:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
25 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
| ^~~~
dungeons.cpp:25:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
25 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
| ^~~~
# | 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... |