Submission #189068

#TimeUsernameProblemLanguageResultExecution timeMemory
189068AQTCrayfish scrivener (IOI12_scrivener)C++14
12 / 100
1041 ms17492 KiB
#include <bits/stdc++.h> using namespace std; struct node{ int p; int len; char c; }; node arr[1000005]; int crnt = 0, idx = 0; int tbl[20][1000005]; void Init(){ arr[0] = {-1, 0, ' '}; } void TypeLetter(char c){ arr[++idx] = {crnt, arr[crnt].len+1, c}; tbl[0][idx] = crnt; for(int d = 1; d<20; d++){ tbl[d][idx] = tbl[d-1][tbl[d-1][idx]]; } crnt = idx; } void UndoCommands(int u){ int temp = crnt; while(u--){ crnt = arr[crnt].p; } } char GetLetter(int p){ int t = crnt; p++; for(int d = 19; d>=0; d--){ if(arr[tbl[d][t]].len >= p){ t = tbl[d][t]; } } return arr[t].c; }

Compilation message (stderr)

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:29:9: warning: unused variable 'temp' [-Wunused-variable]
     int temp = crnt;
         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...