제출 #910036

#제출 시각아이디문제언어결과실행 시간메모리
910036Macker크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
34 / 100
1043 ms13868 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() //#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") struct node { char c; node* par; int len; vector<pair<node*, int>> undo; }; typedef node* pnode; pnode root; pnode cur; void Init() { root = new node(); root->len = -1; cur = root; } void TypeLetter(char L) { pnode tmp = new node(); tmp->par = cur; tmp->undo.push_back({cur, cur->undo.size() - 1}); tmp->c = L; tmp->len = cur->len + 1; cur = tmp; } void UndoCommands(int U) { pnode tmp = cur; int b = tmp->undo.size() - 1; while(U--){ int tb = tmp->undo[b].second; tmp = tmp->undo[b].first; b = tb; } tmp->undo.push_back({cur, cur->undo.size() - 1}); cur = tmp; } char GetLetter(int P) { pnode tmp = cur; while(tmp->len > P){ tmp = tmp->par; } return tmp->c; }
#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...