답안 #79071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
79071 2018-10-11T03:05:45 Z TAMREF 크레이피쉬 글쓰는 기계 (IOI12_scrivener) C++11
0 / 100
247 ms 63032 KB
#include <bits/stdc++.h>
using namespace std;
const int mx = 1e6 + 5;
const int lg = 20;
int C[mx], I[mx];
char X[mx];
int p[mx][lg];
int n;

void show(int i){
    printf("C : %d I : %d X : %c\n",C[i],I[i],X[C[i]]);
}

void Init() {
}

void TypeLetter(char L) {
    ++n;
    I[n] = I[n-1] + 1;
    C[n] = n;
    X[n] = L;
    p[n][0] = n - 1;
    for(int j = 1; j < lg; j++){
        p[n][j] = p[p[j-1][n]][j-1];
    }
}

void UndoCommands(int U) {
    ++n;
    if(U == n){
        I[n] = 0;
        C[n] = 0;
        X[n] = 'U';
        return;
    }
    I[n] = I[n - 1 - U];
    C[n] = C[n - 1 - U];
    p[n][0] = n - 1 - U;
    for(int j = 1; j < lg; j++){
        p[n][j] = p[p[j-1][n]][j-1];
    }
}

char GetLetter(int P) {
    ++P;
    int b = n;
    for(int j = lg-1; j >= 0; j--){
        if(I[b] == P) return X[C[b]];
        if(I[p[b][j]] >= P) b = p[b][j];
    }
    return I[b] == P ? X[C[b]] : X[C[p[b][0]]];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 576 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 208 ms 63032 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 247 ms 63032 KB Output isn't correct
2 Halted 0 ms 0 KB -