Submission #1345020

#TimeUsernameProblemLanguageResultExecution timeMemory
1345020yc11Dungeons Game (IOI21_dungeons)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;


vector<int> s1;
vector<int> p1;
vector<int> w1;
vector<int> l1;
int N;
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
    s1 = s;
    p1 = p;
    w1 = w;
    l1 = l;
    N = n;
	return;
}

long long simulate(int x, int z) {
    while (x!=N){
        if (z>=s[x]){
            z+=s[x];
            x = w[x];
        }
        else{
            z+=p1[x];
            x = l[x];
        }
    }
	return (long long )z;
}

Compilation message (stderr)

dungeons.cpp: In function 'long long int simulate(long long int, long long int)':
dungeons.cpp:22:16: error: 's' was not declared in this scope
   22 |         if (z>=s[x]){
      |                ^
dungeons.cpp:24:17: error: 'w' was not declared in this scope
   24 |             x = w[x];
      |                 ^
dungeons.cpp:28:17: error: 'l' was not declared in this scope
   28 |             x = l[x];
      |                 ^