제출 #103000

#제출 시각아이디문제언어결과실행 시간메모리
103000wxh010910크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
34 / 100
1091 ms94792 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]; jump -= 1 << 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...