Submission #441972

#TimeUsernameProblemLanguageResultExecution timeMemory
441972victoriadDungeons Game (IOI21_dungeons)C++17
11 / 100
7100 ms19748 KiB
#include <cmath> #include <iostream> #include <utility> #include <algorithm> #include <cstdio> #include <vector> #include <string> #include <fstream> #include "dungeons.h" using namespace std; vector<int>nextwin,nextlos,stre,los; int N; void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) { nextwin.resize(n); N=n; for(int i=0;i<n;i++){ nextwin[i]=w[i]; } nextlos.resize(n); for(int i=0;i<n;i++){ nextlos[i]=l[i]; } stre.resize(n); for(int i=0;i<n;i++){ stre[i]=s[i]; } los.resize(n); for(int i=0;i<n;i++){ los[i]=p[i]; } return; } long long simulate(int x, int z) { long long int pow=z; int act=x; while(act!=N){ if(pow>=stre[act]){ pow+=stre[act]; act=nextwin[act]; } else{ pow+=los[act]; act=nextlos[act]; } } return pow; }
#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...