Submission #850911

#TimeUsernameProblemLanguageResultExecution timeMemory
850911promitheasCrayfish scrivener (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
//CrayfishScrivener/IOI2012 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <stdint.h> #define MAXNLOG 22 #define MAXN 1000500 class Node { public: char letter; Node* parents[MAXNLOG+1]; Node(Node* parent, char letter = 0) { this->letter = letter; parents[0] = parent; for (int i = 1; i < MAXNLOG; i++) { if (parents[i - 1]) parents[i] = parents[i - 1]->parents[i - 1]; else parents[i] = nullptr; } } Node* GetNthParent(int n) { Node* tar = this; for (int i = MAXNLOG; i >= 0; i--) { int p = 1 << i; if (n & p)tar = tar->parents[i]; if (!tar)return nullptr; } return tar; } }; Node* NODES[MAXN]; int N = 1; void Init() { NODES[0] = new Node(nullptr, 0); } void TypeLetter(char L) { NODES[N] = new Node(NODES[N++ - 1], L); } void UndoCommands(int U) { NODES[N] = NODES[N++ - 1 - U]; }

Compilation message (stderr)

scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:42:29: warning: operation on 'N' may be undefined [-Wsequence-point]
   42 |  NODES[N] = new Node(NODES[N++ - 1], L);
      |                            ~^~
scrivener.cpp:42:29: warning: operation on 'N' may be undefined [-Wsequence-point]
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:46:20: warning: operation on 'N' may be undefined [-Wsequence-point]
   46 |  NODES[N] = NODES[N++ - 1 - U];
      |                   ~^~
scrivener.cpp:46:20: warning: operation on 'N' may be undefined [-Wsequence-point]
/usr/bin/ld: /tmp/ccDPCPAS.o: in function `main':
grader.cpp:(.text.startup+0x18b): undefined reference to `GetLetter(int)'
collect2: error: ld returned 1 exit status