# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
437839 | WnRS | 던전 (IOI21_dungeons) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
int nnn;
vector<int>sss,ppp,www,lll;
void init(int nn, vector<int> ss, vector<int> pp, vector<int> ww, vector<int> ll) {
nnn=nn;
sss=ss,ppp=pp,www=ww,lll=ll;
}
int simulate(int x, int z) {
// enter dungeon x => strength s[x]
// strength += s[x] if win
// if win: goto w[x]
// lose: increase by p[x]
// goto l[x];
while(x != nnn) {
if(z >= sss[x]) {
z+=sss[x];
x=www[x];
} else {
z+=ppp[x];
x=lll[x];
}
}
return z;
}