# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
117488 | someone_aa | Crayfish scrivener (IOI12_scrivener) | C++17 | 232 ms | 64376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
const int N = (1<<20);
const int LOGN = 20;
char q_type[N];
char last[N];
int len[N], q, position;
int point[N][LOGN];
char type, letter;
int _time, cekori;
int moment;
void Init() {
_time = 1;
moment = 1;
}
void TypeLetter(char letter) {
//cin>>letter;
q_type[_time] = type;
len[_time] = len[_time-1] + 1;
last[_time] = letter;
if(q_type[_time-1] == 'T') point[_time][0] = _time-1;
else if(q_type[_time-1] == 'U') point[_time][0] = point[_time-1][0];
for(int i=1;i<20;i++) {
point[_time][i] = point[point[_time][i-1]][i-1];
}
/*cout<<len[_time]<<" "<<last[_time]<<" Pointers: \n";
for(int i=0;i<20;i++) {
cout<<(1<<i)<<" th-parent: "<<point[_time][i]<<"\n";
}*/
_time++;
}
void UndoCommands(int cekori) {
q_type[_time] = type;
len[_time] = len[_time-cekori-1];
last[_time] = last[_time-cekori-1];
if(q_type[_time-cekori-1] == 'T') point[_time][0] = _time-cekori-1;
else if(q_type[_time-cekori-1] == 'U') point[_time][0] = point[_time-cekori-1][0];
for(int i=1;i<20;i++) {
point[_time][i] = point[point[_time][i-1]][i-1];
}
//cout<<len[_time]<<" "<<point[_time]<<" "<<last[_time]<<"\n";
/*cout<<len[_time]<<" "<<last[_time]<<" Pointers: \n";
for(int i=0;i<20;i++) {
cout<<(1<<i)<<" th-parent: "<<point[_time][i]<<"\n";
}*/
_time++;
}
char GetLetter(int position) {
int ttime = _time - 1;
//cout<<"Query: ";
int temp = len[ttime] - position ;
int c = ttime;
if(q_type[c] == 'U') c = point[c][0];
int left_path = temp;
//cout<<temp<<"\n";
int sum = 0;
for(int i=19;i>=0;i--) {
//cout<<c<<" -> "<<left_path<<"\n";
if(point[c][i] != 0 && left_path - (1<<i) >0 ){
c = point[c][i];
left_path -= (1<<i);
}
}
//cout<<c<<"\n";
return last[c];
}
컴파일 시 표준 에러 (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... |