| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 115570 | faustaadp | Crayfish scrivener (IOI12_scrivener) | C++17 | 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>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
char last;
char hai[1010101];
pair<ll,ll> A[1010101];
ll te,pre[1010101];
void cek()
{
ll ii;
for(ii=0;ii<te;ii++)
cout<<ii<<" "<<char(A[ii].fi)<<" "<<A[ii].se<<"\n";
cout<<"\n";
}
void Init() {}
void TypeLetter(char L)
{
ll bes=0;
if(te>0)
bes=A[te-1].se+1;
A[te]=mp(L,bes);
hai[bes]=L;
pre[te]=te-1;
te++;
// cek();
}
void UndoCommands(int U)
{
A[te]=A[te-U-1];
pre[te]=pre[te-U-1];
te++;
// cek();
}
char GetLetter(int P)
{
ll ii;
for(ii=te-1;ii=pre[ii])
if(A[ii].se==P)
return char(A[ii].fi);
// return hai[P];
}
