# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41246 | mirbek01 | Crayfish scrivener (IOI12_scrivener) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
# define pb push_back
# define fr first
# define sc second
# define mk make_pair
using namespace std;
const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
typedef long long ll;
int q, sz;
char s[N];
string ans;
int main(){
scanf("%d", &q);
while(q --){
char ch, a;
cin >> ch;
if(ch == 'T'){
cin >> a;
s[sz ++] = a;
}
if(ch == 'P'){
int P;
cin >> P;
ans += s[P];
}
if(ch == 'U'){
int u;
cin >> u;
sz -= u;
}
}
cout << ans << endl;
}