Submission #437628

#TimeUsernameProblemLanguageResultExecution timeMemory
437628yiqilim5438Dungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include"dungeons.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
int n;
vector<ll>s,p,w,l;
vector<ll>tt(5e4+5,0ll);
vector<vector<pll>>ls(1005,vector<pll>(5e4+5));
void init(int N,vector<ll>S,vector<ll>P,vector<ll>W,vector<ll>L){
       n = N,s = S,p = P,w = W,l = L;
       for(int i = n-1;i>=0;i--){
           tt[i] = s[i]+s[w[i]];
       }
       for(int i = 0;i<n;i++){
            int x = i;
           for(int j = 1;j<=1000;j++){
                ls[i][j].first = ls[i][j-1].first+p[x];
                x = l[x];
                ls[i][j].second = x;
           }
       }
};

ll simulate(int x,int z){
     if(z>=s[x]){
        return z+tt[x];
     }
     else{
        if(z+ls[x][1000].first>=s[x]){
            while(true){
                if(z>=s[x]) return z+tt[x];
                else z += p[x];
                x = l[x];
            }
        }
        else{
            z += ls[x][1000].first;
            x = ls[x][1000].second;
            return simulate(x,z);
        }
     }
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccQ8Nu4Q.o: in function `main':
grader.cpp:(.text.startup+0x3bd): undefined reference to `init(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status