Submission #747800

#TimeUsernameProblemLanguageResultExecution timeMemory
747800ThegeekKnight16Crayfish scrivener (IOI12_scrivener)C++14
100 / 100
970 ms90192 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") const int MAXN = 1e6 + 10; const int MAXK = 21; vector<char> v; vector<int> tam; int dp[MAXN][MAXK]; int id = 0; void Init() { v.push_back('-'); tam.push_back(-1); } void TypeLetter(char L) { v.push_back(L); tam.push_back(tam.back()+1); ++id; dp[id][0] = id-1; for (int k = 1; k < MAXK; k++) dp[id][k] = dp[ dp[id][k-1] ][k-1]; } void UndoCommands(int U) { tam.push_back(tam[id-U]); v.push_back('X'); dp[id+1][0] = id-U; ++id; for (int k = 1; k < MAXK; k++) dp[id][k] = dp[ dp[id][k-1] ][k-1]; } char GetLetter(int P) { int X = id; for (int k = MAXK-1; k >= 0; k--) { if (tam[dp[X][k]] >= P) X = dp[X][k]; } return v[X]; }
#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...