Submission #104261

#TimeUsernameProblemLanguageResultExecution timeMemory
104261arman_ferdousCrayfish scrivener (IOI12_scrivener)C++14
0 / 100
699 ms87332 KiB
// #include "grader.h" #include <bits/stdc++.h> using namespace std; const int N = 1e6+10; char c[N]; int lev[N]; int cur, freePtr; int p[N][20], state[N], ptr; void Init() { lev[0] = -1; memset(p,-1,sizeof p); c[0] = '?'; cur = 0; freePtr = 1; state[0] = cur; ptr = 0; } void TypeLetter(char L) { int idx = freePtr++; p[idx][0] = cur; c[idx] = L, lev[idx] = lev[cur] + 1; cur = idx; for(int j = 1; j < 20; j++) if(p[cur][j-1] + 1) p[cur][j] = p[p[cur][j-1]][j-1]; state[++ptr] = cur; } void UndoCommands(int U) { state[ptr+1] = state[max(0, ptr - U)]; ptr++; cur = state[ptr]; } char GetLetter(int P) { int tmp = cur, need = lev[cur] - P; for(int j = 19; j >= 0; j--) if(need >= (1<<j)) { need -= (1<<j); cur = p[cur][j]; } return c[cur]; }

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:38:6: warning: unused variable 'tmp' [-Wunused-variable]
  int tmp = cur, need = lev[cur] - P;
      ^~~
#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...