# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
482274 | wnsduds1 | 크레이피쉬 글쓰는 기계 (IOI12_scrivener) | C11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<bitset>
#include<string>
#define SIZE 101
#define INF 987654321
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
int n;
int main() {
fastio;
string s;
string v;
vector<string>str(n);
vector<char>ret;
int idx = 0;
cin >> n;
while (n--) {
cin >> s;
if (s == "T") {
cin >> v;
if (idx == 0)
str.push_back(v);
else
str.push_back(str[idx - 1] + v);
idx += 1;
}
else if (s == "U") {
int value;
cin >> value;
str.push_back(str[idx - (value+1)]);
idx += 1;
}
else {
int value;
cin >> value;
ret.push_back(str[idx - 1][value]);
}
}
for (auto&ele : ret) {
cout << ele << "\n";
}
}