This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
int nb=0;
vector<pair<int, int> >v;
string s;
void Init()
{
nb=0;
v.clear();
s="";
}
void TypeLetter(char L)
{
nb++;
v.push_back(make_pair(0, L-'a'));
}
void UndoCommands(int U)
{
nb++;
v.push_back(make_pair(1, U));
}
char GetLetter(int P)
{
if(nb==0)
return s[P];
nb=0;
int cnt=0, l=0;
s="";
for(int i = v.size()-1; i >= 0; i--)
{
if(v[i].first==0)
{
if(!cnt)
s+=(char)('a'+v[i].second);
}
else
{
if(!cnt)
{
cnt=1;
l=i-v[i].second;
}
}
if(i==l && cnt)
cnt=0;
}
reverse(s.begin(), s.end());
return s[P];
}
# | 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... |