Submission #523221

#TimeUsernameProblemLanguageResultExecution timeMemory
523221marat0210Dungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include <dungeons.h> #include <bits/stdc++.h> using namespace std; vector <long long> a, b, win, lose; void init(long long n, vector <long long> s, vector <long long> p, vector <long long> w, vector <long long> l) { for (int i = 0; i < n; ++i) { a.push_back(s[i]); b.push_back(p[i]); win.push_back(w[i]); lose.push_back(l[i]); } } long long simulate(long long x, long long z) { long long cur = z, d = x; while (1) { if (d == a.size()) { break; } if (cur >= a[d]) { cur += a[d]; d = win[d]; } else { cur += b[d]; d = lose[d]; } } return cur; }

Compilation message (stderr)

dungeons.cpp: In function 'long long int simulate(long long int, long long int)':
dungeons.cpp:22:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if (d == a.size()) {
      |             ~~^~~~~~~~~~~
/usr/bin/ld: /tmp/ccu5bR07.o: in function `main':
grader.cpp:(.text.startup+0x3bd): undefined reference to `init(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x440): undefined reference to `simulate(int, int)'
collect2: error: ld returned 1 exit status