제출 #600977

#제출 시각아이디문제언어결과실행 시간메모리
600977Valaki2던전 (IOI21_dungeons)C++17
11 / 100
7018 ms31804 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; #define n N #define s S #define p P #define w W #define l L #define int long long #define pb push_back int n; vector<int> win_str, lose_str, win_pos, lose_pos; void solve() { // } int query(int pos, int strength) { while(pos != n) { if(strength < win_str[pos]) { strength += lose_str[pos]; pos = lose_pos[pos]; } else { strength += win_str[pos]; pos = win_pos[pos]; } } return strength; } #undef n #undef s #undef p #undef w #undef l void init(signed n, vector<signed> s, vector<signed> p, vector<signed> w, vector<signed> l) { N = n; win_str = lose_str = win_pos = lose_pos = (vector<int> (n + 1, 0)); for(int i = 0; i < n; i++) { win_str[i] = s[i]; lose_str[i] = p[i]; win_pos[i] = w[i]; lose_pos[i] = l[i]; } win_str[n] = 0; lose_str[n] = 0; win_pos[n] = n; lose_pos[n] = n; solve(); } int simulate(signed x, signed z) { return query(x, z); }
#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...