Submission #679989

#TimeUsernameProblemLanguageResultExecution timeMemory
679989Ahmed57크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //TRIE struct node{ node *nxt[26]; int ind; node(){ ind = -1; for(int i = 0;i<26;i++){ nxt[i] = NULL; } } }; map<int,node*> mp; map<int,char> ch; node* root = new node(); int op = 0; void init(){ mp[op] = root; } void TypeLetter(char l){ if(root->nxt[l-'a']==NULL){ root->nxt[l-'a'] = new node(); } int z = root->ind; root = root->nxt[l-'a']; root->ind = z+1; ch[z+1] = l; mp[++op] = root; } void UndoCommands(int u){ mp[++op] = mp[op-(u+1)]; root = mp[op]; } char GetLetter(int p){ return ch[p]; } /*int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); init(); TypeLetter('a'); TypeLetter('b'); cout<<GetLetter(1)<<"\n"; TypeLetter('d'); UndoCommands(2); UndoCommands(1); cout<<GetLetter(2)<<"\n"; }*/

Compilation message (stderr)

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:34:8: warning: operation on 'op' may be undefined [-Wsequence-point]
   34 |     mp[++op] = mp[op-(u+1)];
      |        ^~~~
/usr/bin/ld: /tmp/ccWPfLRE.o: in function `main':
grader.cpp:(.text.startup+0x63): undefined reference to `Init()'
collect2: error: ld returned 1 exit status