이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dungeons.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define all(v) v.begin(),v.end()
const ll M=4e5+10;
const ll inf=2e18;
const ll lg=30;
ll go[lg][M],sm[lg][M],awin[M],difficulty;
void init(int n,vector<int>s,vector<int>p,vector<int>w,vector<int>l) {
l.pb(n);
p.pb(0);
awin[n]=0;
for(int i=n-1;i>=0;i--){
awin[i]=awin[w[i]]+s[0];
}
difficulty=s[0];
for(int i=0;i<=n;i++)
go[0][i]=l[i],sm[0][i]=p[i];
for(int bit=1;bit<lg;bit++){
for(int i=0;i<=n;i++){
sm[bit][i]=sm[bit-1][i]+sm[bit-1][go[bit-1][i]];
go[bit][i]=go[bit-1][go[bit-1][i]];
}
}
}
long long simulate(int x, int z){
for(int bit=lg-1;bit>=0;bit--){
if(z+sm[bit][x]<difficulty)
z+=sm[bit][x],x=go[bit][x];
}
if(z<difficulty)
z+=sm[0][x],x=go[0][x];
z+=awin[x];
return z;
}
# | 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... |