제출 #441124

#제출 시각아이디문제언어결과실행 시간메모리
441124A_DDungeons Game (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> #define LL long long using namespace std; const LL L=30; const LL N=4e5+100; const LL H=7; LL st[N][L][H]; LL cost[N][L][H]; set<LL> stt; vector<LL> vec; LL nn; vector<LL> s,p,w,l; void init(LL n,vector<int> S,vector<int> P,vector<int> W,vector<int> LLL){ for(int i=0;i<nn;i++){ s.push_back(S[i]); p.push_back(P[i]); w.push_back(W[i]); l.push_back(LLL[i]); } nn=n; for(int i=0;i<nn;i++){ stt.insert(s[i]); } if(stt.size()>5)assert(0); vec.push_back(0); for(auto x:stt)vec.push_back(x); while(vec.size()<H+1){ vec.push_back(1e9); } for(int h=0;h<H;h++){ st[nn][0][h]=nn; for(int i=0;i<nn;i++){ if(vec[h]>=s[i]){ st[i][0][h]=w[i]; cost[i][0][h]=s[i]; } else{ st[i][0][h]=l[i]; cost[i][0][h]=p[i]; } } } for(int h=0;h<H;h++){ for(int j=1;j<L;j++){ for(int i=0;i<=nn;i++){ st[i][j][h]=st[st[i][j-1][h]][j-1][h]; cost[i][j][h]=cost[i][j-1][h]+cost[st[i][j-1][h]][j-1][h]; } } } } long long simulate(int xx, int zz){ LL x=xx; LL z=zz; for(int h=0;h<H;h++){ for(int j=L-1;j>=0;j--){ LL nx=st[x][j][h]; LL c=z+cost[x][j][h]; if(c<vec[h+1]&&x!=nn){ x=nx; x=c; } } if(x!=nn&&z<vec[h+1]){ z+=cost[x][0][h]; x=st[x][0][h]; } } return z; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccH8iVX0.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