Submission #639516

#TimeUsernameProblemLanguageResultExecution timeMemory
639516tadeCrayfish scrivener (IOI12_scrivener)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; struct trie_node { int child[26]; char letter; int depth; trie_node() { memset(child, -1, sizeof(child)); depth = 0; } }; int st[100005][22]; vector<trie_node> trie; vector<int> cmds; int node = 0; void Init() { trie.push_back(trie_node()); trie[0].letter = '#'; trie[0].depth = -1; cmds.push_back(0); } void TypeLetter(char L) { int nxt = L - 'a'; if(trie[node].child[nxt] == -1) { trie[node].child[nxt] = trie.size(); trie.push_back(trie_node()); } int parent = node; node = trie[node].child[nxt]; trie[node].letter = L; trie[node].depth = trie[parent].depth + 1; st[node][0] = parent; for(int i = 1; i < 22; ++ i) st[node][i] = st[st[node][i - 1]][i - 1]; cmds.push_back(node); } void UndoCommands(int U) { node = cmds[cmds.size() - U - 1]; cmds.push_back(node); } char GetLetter(int P) { int jump_dist = trie[node].depth - P; int jump_node = node; for(int i = 0; i < 22 && jump_dist > 0; ++ i) { if(jump_dist & 1) jump_node = st[jump_node][i]; jump_dist >>= 1; } return trie[jump_node].letter; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccf9xo9T.o: in function `main':
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