Submission #386846

#TimeUsernameProblemLanguageResultExecution timeMemory
386846iliccmarkoCrayfish scrivener (IOI12_scrivener)C++14
0 / 100
452 ms53864 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define INF 1000000000 #define LINF 10000000000000000LL #define pb push_back #define all(x) x.begin(), x.end() #define len(s) (int)s.size() #define test_case { int t; cin>>t; while(t--)solve(); } #define single_case solve(); #define line cerr<<"----------"<<endl; #define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); } #define mod 1000000007LL const int N = 1e6 + 50; int up[N][21]; int cvor[N]; int ind; int ind2; char s[N]; int dub[N]; void Init() { } void TypeLetter(char l) { ind++; ind2++; cvor[ind2] = ind; s[ind] = l; up[ind][0] = cvor[ind2-1]; dub[ind] = dub[cvor[ind2-1]] + 1; for(int i = 1;i<=20;i++) up[ind][i] = up[up[ind][i-1]][i-1]; } void UndoCommands(int u) { ind2++; cvor[ind2] = cvor[ind2-1-u]; } char GetLetter(int p) { p++; int x = cvor[ind2]; for(int i = 0;i<=20;i++) { int w = up[x][i]; if(dub[w]<p) continue; x = w; } return s[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...