Submission #472852

#TimeUsernameProblemLanguageResultExecution timeMemory
472852blueDungeons Game (IOI21_dungeons)C++17
11 / 100
7021 ms41088 KiB
#include "dungeons.h" #include <vector> #include <iostream> using namespace std; const int maxN = 50'000; int N; vector<int> S, P, W, L; vector<long long> winscore(1+maxN, 0LL); void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { N = n; //number of opponents S = s; //strength of opponent i == strength increase upon winning P = p; //strength increase upon losing W = w; //winning move L = l; //losing move for(int i = N-1; i >= 0; i--) winscore[i] = winscore[ W[i] ] + S[i]; return; } long long simulate(int x, int z) { // cerr << x << ' ' << z << '\n'; long long Z = z; while(x != N && Z < 10'000'000) { if(Z >= S[x]) { Z += S[x]; x = W[x]; } else { Z += P[x]; x = L[x]; } // cerr << x << ' ' << Z << '\n'; } return Z + winscore[x]; }

Compilation message (stderr)

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for(int i = N-1; i >= 0; i--)
      |     ^~~
dungeons.cpp:24:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   24 |  return;
      |  ^~~~~~
#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...