Submission #1008633

#TimeUsernameProblemLanguageResultExecution timeMemory
1008633nisanduuDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; typedef long long ll; ll N = 1e5 + 10; vector<ll> as,ap,aw,al; int solve(int x,int z){ if(x==N) return z; if(as[x]>z){ int nz = z+as[x]; return solve(aw[x],nz); }else{ int nz = z+ap[x]; return solve(al[x],nz); } } int64 simulate(int x,int z){ int ans = solve(x,z); return ans; } void init(int n,int[] s,int[] p,int[] w,int[] l){ N = n; for(auto z:s){ as.push_back(z); } for(auto z:p){ ap.push_back(z); } for(auto z:w){ aw.push_back(z); } for(auto z:l){ al.push_back(z); } } // int main() // { // init(3, [2, 6, 9], [3, 1, 2], [2, 2, 3], [1, 0, 1]); // cout<<simulate(0, 1)<<endl; // return 0; // }

Compilation message (stderr)

dungeons.cpp:26:1: error: 'int64' does not name a type; did you mean 'int64_t'?
   26 | int64 simulate(int x,int z){
      | ^~~~~
      | int64_t
dungeons.cpp:31:23: error: expected ',' or '...' before 's'
   31 | void init(int n,int[] s,int[] p,int[] w,int[] l){
      |                       ^
dungeons.cpp: In function 'void init(int, int*)':
dungeons.cpp:33:16: error: 's' was not declared in this scope
   33 |     for(auto z:s){
      |                ^
dungeons.cpp:36:16: error: 'p' was not declared in this scope
   36 |     for(auto z:p){
      |                ^
dungeons.cpp:39:16: error: 'w' was not declared in this scope
   39 |     for(auto z:w){
      |                ^
dungeons.cpp:42:16: error: 'l' was not declared in this scope
   42 |     for(auto z:l){
      |                ^