# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425738 | dxz05 | 크레이피쉬 글쓰는 기계 (IOI12_scrivener) | C++14 | 1090 ms | 2432 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>
using namespace std;
const int N = 1e6 + 3e2;
int commands;
int prv[N];
bool ok[N];
char ch[N];
void dbg(){
return;
for (int i = 0; i < commands; i++) cout << ch[i] << ' '; cout << endl;
for (int i = 0; i < commands; i++) cout << ok[i] << ' '; cout << endl;
cout << endl;
}
void Init() {
commands = 0;
fill(ch, ch + N, '?');
}
void TypeLetter(char L) {
ok[commands] = true;
prv[commands] = 1e9;
ch[commands] = L;
commands++;
dbg();
}
vector<int> undo;
void UndoCommands(int U) {
ok[commands] = true;
prv[commands] = commands - U;
undo.push_back(commands);
for (int i = undo.size() - 1; i >= 0; i--){
int j = undo[i];
if (j >= prv[commands]) prv[commands] = min(prv[commands], prv[j]);
}
for (int i = prv[commands]; i < commands; i++) ok[i] ^= 1;
commands++;
dbg();
}
char GetLetter(int P) {
char ans = '?';
for (int i = 0; i < commands; i++){
if (ok[i] && ch[i] != '?'){
if (P == 0){
ans = ch[i];
break;
}
P--;
}
}
dbg();
return ans;
}
/**
14
T a
T b
P 1
T d
U 2
U 1
P 2
T e
U 1
U 5
T c
P 2
U 2
P 2
*/
Compilation message (stderr)
# | 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... |