Submission #654296

#TimeUsernameProblemLanguageResultExecution timeMemory
654296as111Crayfish scrivener (IOI12_scrivener)C++17
5 / 100
409 ms64164 KiB
#include <iostream> #define MAX 1000000 using namespace std; char letter[MAX + 1]; int A[MAX + 1][21]; int back[MAX + 1]; // if undo, how far back to go, otherwise go back to current int curr; void Init() { for (int i = 0; i <= MAX; i++) { back[i] = i; } curr = 0; } void TypeLetter(char L) { curr++; letter[curr] = L; int prev = back[curr - 1]; // previous index A[curr][0] = prev; for (int j = 1; j <= 20; j++) { A[curr][j] = A[A[curr][j - 1]][j - 1]; } } void UndoCommands(int U) { curr++; letter[curr] = '0'; back[curr] = back[curr - U - 1]; // position to go back to } char GetLetter(int P) { P++; int pos = curr; for (int j = 20; j >= 0; j--) { if (A[pos][j] >= P) { pos = A[pos][j]; } } return letter[pos]; }
#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...