Submission #896243

#TimeUsernameProblemLanguageResultExecution timeMemory
896243Sir_Ahmed_ImranDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
///~~~LOTA~~~/// #include "dungeons.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define N 400001 ll n; ll l[N][19]; ll w[N][19]; ll sl[N][19]; ll sw[N][19]; ll rw[N][19]; ll rl[N][19]; void init(int m,vector<int> s,vector<int> p,vector<int> W,vector<int> L){ n=m; w[n][0]=n; rw[n][0]=1e17; for(int i=0;i<n;i++){ l[i][0]=L[i]; w[i][0]=W[i]; sl[i][0]=p[i]; sw[i][0]=s[i]; rl[i][0]=s[i]+p[i]; rw[i][0]=s[i]+s[i]; } for(int j=0;j<18;j++){ for(int i=0;i<=n;i++){ l[i][j+1]=l[l[i][j]][j]; w[i][j+1]=w[w[i][j]][j]; sl[i][j+1]=sl[i][j]+sl[l[i][j]][j]; sw[i][j+1]=sw[i][j]+sw[w[i][j]][j]; rl[i][j+1]=min(rl[l[i][j]][j],rl[i][j]+sl[l[i][j]][j]); rw[i][j+1]=max(rw[w[i][j]][j],rw[i][j]+sw[w[i][j]][j]); } } } ll simulate(ll x,ll z){ int t=0; while(x!=n){ if(t==1){ for(int j=18;j>=0;j--){ if(rw[x][j]<=sw[x][j]+z){ z+=sw[x][j]; x=w[x][j]; } } } else{ for(int j=18;j>=0;j--){ if(rl[x][j]>sl[x][j]+z){ z+=sl[x][j]; x=l[x][j]; } } } t=(t+1)%2; } return z; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cctu9kGx.o: in function `main':
grader.cpp:(.text.startup+0x440): undefined reference to `simulate(int, int)'
collect2: error: ld returned 1 exit status