# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
119829 | 2019-06-22T13:13:14 Z | dolphingarlic | 크레이피쉬 글쓰는 기계 (IOI12_scrivener) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; pair<char, char> v[1000001]; char s[1000001]; int indx = 0, i = 0; bool got = false; void Init() { } void TypeLetter(char L) { v[indx++] = {'T', L}; } void UndoCommands(int U) { v[indx++] = {'U', (char)U}; } char GetLetter(int P) { if (!got) { int ptr = indx - 1; while (ptr != -1) { while (ptr != -1 && v[ptr].first == 'U') ptr -= v[ptr].second + 1; s[i++] = v[ptr--].second; } got = true; } return t[i - 1 - P]; } // int main() { // int t; // cin >> t; // for (int i = 0; i < t; i++) { // char c, d; int e; // cin >> c; // switch (c) { // case 'T': // cin >> d; // TypeLetter(d); // break; // case 'P': // cin >> e; // cout << GetLetter(e) << '\n'; // break; // default: // cin >> e; // UndoCommands(e); // } // } // }