제출 #102999

#제출 시각아이디문제언어결과실행 시간메모리
102999wxh010910크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
0 / 100
1080 ms89560 KiB
#include <bits/stdc++.h> using namespace std; vector<int> from, depth; vector<vector<int>> anc; vector<char> type; void Init() { type.push_back(' '); depth.push_back(0); anc.push_back(vector<int>()); from.push_back(0); } void TypeLetter(char L) { type.push_back(L); depth.push_back(depth[from.back()] + 1); anc.push_back(vector<int>(1, from.back())); for (int i = 1; depth.back() >> i; ++i) { anc.back().push_back(anc[anc.back()[i - 1]][i - 1]); } from.push_back(from.size()); } void UndoCommands(int U) { type.push_back(' '); depth.push_back(-1); anc.push_back(vector<int>()); from.push_back(from[from.size() - 1 - U]); } char GetLetter(int P) { int jump = depth[from.back()] - 1 - P; int x = from.back(); for (int i = 0; jump; ++i) { if (jump >> i & 1) { x = anc[x][i]; } } return type[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...