이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 s[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);
// }
// }
// }
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |