Submission #749361

#TimeUsernameProblemLanguageResultExecution timeMemory
749361tosivanmakCrayfish scrivener (IOI12_scrivener)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include<bits/stdc++.h> using namespace std; #define ll int #ifdef __cplusplus extern "C" { #endif void Init(); void TypeLetter(char L); void UndoCommands(int U); char GetLetter(int P); #ifdef __cplusplus } #endif // TODO: global variables can be declared here struct info{ ll lver,rver; }; vector<info>seg[524500]; ll vernochar[1000001]; ll versionofcommand[1000001]; vector<char>opt[1000001]; void build(ll l, ll r, ll id){ if(l==r){ return; } else{ ll mid=(l+r)>>1; build(l,mid,id*2); build(mid+1,r,id*2+1); seg[id].push_back({0,0}); } } char qry(ll version, ll ql, ll l, ll r, ll id){ if(l==r){ return opt[ql][version-1]; } else{ ll mid=(l+r)>>1; if(ql<=mid){ return qry(seg[id][version].lver,ql,l,mid,id*2); } else{ return qry(seg[id][version].rver,ql,mid+1,r,id*2+1); } } } void upd(ll version, ll ul, ll l, ll r, char app, ll id){ if(l==r){ opt[ul].push_back(app); } else{ ll mid=(l+r)>>1; if(ul<=mid){ upd(seg[id][version].lver,ul,l,mid,app,id*2); ll siz=seg[id*2].size()-1; seg[id].push_back({siz,seg[id][version].rver}); } else{ upd(seg[id][version].rver,ul,mid+1,r,app,id*2+1); ll siz=seg[id*2+1].size()-1; seg[id].push_back({seg[id][version].lver,siz}); } } } ll curcom=1; void Init() { build(1,1000000,1); vernochar[0]=0; versionofcommand[0]=0; } void TypeLetter(char L){ // TODO: implementation ll acccom=curcom-1; ll lol=versionofcommand[acccom]; ll k=vernochar[lol]; upd(lol,k+1,1,1000000,L,1); vernochar[seg[1].size()-1]=k+1; versionofcommand[curcom]=seg[1].size()-1; curcom++; } void UndoCommands(int U){ // TODO: implementation ll acccom=curcom-U-1; versionofcommand[curcom]=versionofcommand[acccom]; curcom++; } char GetLetter(int P){ // TODO: implementation ll version=versionofcommand[curcom-1]; // cout<<version<<'\n'; P++; return qry(version,P,1,1000000,1); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccQ44Z4s.o: in function `main':
grader.cpp:(.text.startup+0x63): undefined reference to `Init()'
/usr/bin/ld: grader.cpp:(.text.startup+0xff): undefined reference to `TypeLetter(char)'
/usr/bin/ld: grader.cpp:(.text.startup+0x15f): undefined reference to `UndoCommands(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x18b): undefined reference to `GetLetter(int)'
collect2: error: ld returned 1 exit status