제출 #441112

#제출 시각아이디문제언어결과실행 시간메모리
441112Quang던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h" #include <vector> #include <bits/stdc++.h> using namespace std; set<int> values; bool all_equal = true; int n; void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) { n = s.size(); set<int> values; for (auto u : s) { values.insert(u); } for (int i = 0; i < n; i++) { all_equal &= (s[i] == p[i]); } if (values.size() <= 5) { } } long long SolveAllEqual(int x, int z) { long long res = z; int cur = x; while (x != n) { if (res >= s[x]) { res += s[x]; x = w[x]; } else { res += p[x]; x = l[x]; } } return res; } long long simulate(int x, int z) { if (all_equal) return SolveAllEqual(x, z); return 0; }

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

dungeons.cpp: In function 'long long int SolveAllEqual(int, int)':
dungeons.cpp:31:14: error: 's' was not declared in this scope
   31 |   if (res >= s[x]) {
      |              ^
dungeons.cpp:33:8: error: 'w' was not declared in this scope
   33 |    x = w[x];
      |        ^
dungeons.cpp:35:11: error: 'p' was not declared in this scope
   35 |    res += p[x];
      |           ^
dungeons.cpp:36:8: error: 'l' was not declared in this scope
   36 |    x = l[x];
      |        ^
dungeons.cpp:29:6: warning: unused variable 'cur' [-Wunused-variable]
   29 |  int cur = x;
      |      ^~~