제출 #720869

#제출 시각아이디문제언어결과실행 시간메모리
720869urosk던전 (IOI21_dungeons)C++17
0 / 100
7056 ms70552 KiB
#include "dungeons.h" #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; #define maxn 400005 ll n; vector<ll> g[maxn]; vector<ll> v[maxn]; ll a[maxn],b[maxn]; bool sub3 = 1; void init(int N, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { n = N; for(ll i = 1;i<=n;i++) a[i] = s[i-1]; for(ll i = 1;i<=n;i++) b[i] = p[i-1]; for(ll i = 1;i<n;i++) sub3&=(a[i]==a[i+1]); for(ll i = 1;i<=n;i++){ if(sub3) v[w[i-1]+1].pb(i); else v[i].pb(w[i-1]+1); } for(ll i = 1;i<=n;i++) g[i].pb(l[i-1]+1); return; } long long simulate(int x, int z) { x++; if(!sub3){ while(x!=n+1){ if(z>a[x]){ z+=a[x]; x = v[x][0]; }else{ z+=b[x]; x = g[x][0]; } } return z; } return 0; } /** 3 2 2 6 9 3 1 2 2 2 3 1 0 1 0 1 2 3 **/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...