제출 #472850

#제출 시각아이디문제언어결과실행 시간메모리
472850blueDungeons Game (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h" #include <vector> #include <iostream> using namespace std; 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); }

컴파일 시 표준 에러 (stderr) 메시지

dungeons.cpp:9:30: error: 'maxN' was not declared in this scope
    9 | vector<long long> winscore(1+maxN, 0LL);
      |                              ^~~~
dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:19:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |     for(int i = N-1; i >= 0; i--)
      |     ^~~
dungeons.cpp:22:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   22 |  return;
      |  ^~~~~~
dungeons.cpp: In function 'long long int simulate(int, int)':
dungeons.cpp:43:25: error: 'X' was not declared in this scope
   43 |     return Z + winscore(X);
      |                         ^