Submission #680769

#TimeUsernameProblemLanguageResultExecution timeMemory
680769BlagojDungeons Game (IOI21_dungeons)C++17
0 / 100
1 ms340 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; vector<int> str, ls, wn, lsd, d; int N, mx = 0; void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) { d.resize(n + 2, 0); N = n, str = s, ls = p, wn = w, lsd = l; vector<int> r(n + 2); for (int i = 0; i < w.size(); i++) { r[w[i]] = i; } for (auto x : s) mx = max(mx, x); int pos = n; set<int> st; long long sum = 0; while (!st.count(pos)) { st.insert(pos); if (pos != n) sum += s[pos]; d[pos] = sum; pos = r[pos]; } return; } long long simulate(int x, int z) { while (x != N) { if (z >= mx) { z += d[x]; break; } if (z >= str[x]) { z += str[x]; x = wn[x]; } else { z += ls[x]; x = lsd[x]; } } return z; }

Compilation message (stderr)

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:12:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for (int i = 0; i < w.size(); i++) {
      |                  ~~^~~~~~~~~~
#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...