Submission #921542

#TimeUsernameProblemLanguageResultExecution timeMemory
921542Alihan_8Crayfish scrivener (IOI12_scrivener)C++17
34 / 100
1036 ms116424 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define ar array #define pb push_back #define ln '\n' //#define int long long using i64 = long long; template <class F, class _S> bool chmin(F &u, const _S &v){ bool flag = false; if ( u > v ){ u = v; flag |= true; } return flag; } template <class F, class _S> bool chmax(F &u, const _S &v){ bool flag = false; if ( u < v ){ u = v; flag |= true; } return flag; } vector <vector<int>> a; vector <int> def, d; vector <char> t; void Init() { def.resize(21); a.pb(def); d.pb(0); t.pb('#'); } void TypeLetter(char L) { int i = (int)a.size(); a.pb(def); d.pb(d.back() + 1); a[i][0] = i - 1; for ( int j = 1; j <= 20; j++ ){ a[i][j] = a[a[i][j - 1]][j - 1]; } t.pb(L); } void UndoCommands(int U) { int i = (int)a.size(); a.pb(def); a[i][0] = i - U - 1; d.pb(d[i - U - 1]); for ( int j = 1; j <= 20; j++ ){ a[i][j] = a[a[i][j - 1]][j - 1]; } t.pb('-'); } char GetLetter(int P) { int i = (int)a.size() - 1; for ( int j = 20; j >= 0; j-- ){ if ( d[a[i][j]] >= P + 1 ){ i = a[i][j]; } } return t[i]; }
#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...