Submission #446859

#TimeUsernameProblemLanguageResultExecution timeMemory
446859ComPhyParkCrayfish scrivener (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
#include<cstdio> #include<malloc.h> #include<vector> using namespace std; int n; typedef struct node { int depth; char data; node* anc[22]; node* child[26]; void init(char d, node* par) { data = d; if (par != NULL) { depth = par->depth + 1; } else depth = 0; int i = 0; anc[0] = par; while (anc[i] != NULL) { i++; anc[i] = anc[i - 1]->anc[i - 1]; } for (; i < 22; i++)anc[i] = NULL; for (int i = 0; i < 26; i++)child[i] = NULL; } node* getChild(char nxt) { if (child[nxt - 'a'] == NULL) { child[nxt - 'a'] = (node*)malloc(sizeof(node)); child[nxt - 'a']->init(nxt, this); } return child[nxt - 'a']; } char getAnc(int d) { if (!d)return data; int i = 0; while (!(d & 1)) { d >>= 1; i++; } return anc[i]->getAnc((d ^ 1) << i); } }node; vector<node*>v; void init(int N) { n = N; node* nd = (node*)malloc(sizeof(node)); nd->init(0, NULL); v.push_back(nd); } void TypeLetter(char a) { v.push_back(v.back()->getChild(a)); } void UndoCommands(int a) { v.push_back(v[v.size() - a - 1]); } char GetLetter(int a) { return v.back()->getAnc(v.back()->depth - a - 1); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccfjpv1N.o: in function `main':
grader.cpp:(.text.startup+0x63): undefined reference to `Init()'
collect2: error: ld returned 1 exit status