Submission #523224

#TimeUsernameProblemLanguageResultExecution timeMemory
523224marat0210Dungeons 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(int n, vector <int> s, vector <int> p, vector <int> w, vector <int> 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/ccI13qBA.o: in function `main':
grader.cpp:(.text.startup+0x440): undefined reference to `simulate(int, int)'
collect2: error: ld returned 1 exit status