Submission #437839

#TimeUsernameProblemLanguageResultExecution timeMemory
437839WnRSDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;

int nnn;
vector<int>sss,ppp,www,lll;

void init(int nn, vector<int> ss, vector<int> pp, vector<int> ww, vector<int> ll) {
    nnn=nn;
    sss=ss,ppp=pp,www=ww,lll=ll;
}

int simulate(int x, int z) {
    // enter dungeon x => strength s[x]
    // strength += s[x] if win
    // if win: goto w[x]
    // lose: increase by p[x]
    // goto l[x];

    while(x != nnn) {
        if(z >= sss[x]) {
            z+=sss[x];
            x=www[x];
        } else {
            z+=ppp[x];
            x=lll[x];
        }
    }
    return z;
}

Compilation message (stderr)

dungeons.cpp:13:5: error: ambiguating new declaration of 'int simulate(int, int)'
   13 | int simulate(int x, int z) {
      |     ^~~~~~~~
In file included from dungeons.cpp:1:
dungeons.h:4:11: note: old declaration 'long long int simulate(int, int)'
    4 | long long simulate(int x, int z);
      |           ^~~~~~~~