Submission #523223

#TimeUsernameProblemLanguageResultExecution timeMemory
523223marat0210Dungeons 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 == (long long)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)

/usr/bin/ld: /tmp/ccHZyGeU.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