Submission #837874

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


int n;
vector<int>s,p,w,l;
void init(int N, vector<int> S,vector<int> P,vector<int> W,vector<int> L) {
	s=S;
    p=P;
    w=W;
    l=L;
}

ll simulate(int i, int curr) {
    while(i != n){
        if(curr >= s[i]){
            curr+=s[i];
            idx=w[i];
        }
        else{
            curr+=p[i];
            idx=l[i];
        }
    }
	return curr;
}

Compilation message (stderr)

dungeons.cpp: In function 'll simulate(int, int)':
dungeons.cpp:20:13: error: 'idx' was not declared in this scope; did you mean 'index'?
   20 |             idx=w[i];
      |             ^~~
      |             index
dungeons.cpp:24:13: error: 'idx' was not declared in this scope; did you mean 'index'?
   24 |             idx=l[i];
      |             ^~~
      |             index