답안 #70921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70921 2018-08-23T17:15:28 Z FLDutchman 크레이피쉬 글쓰는 기계 (IOI12_scrivener) C++14
0 / 100
208 ms 68144 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)

struct llist{
    vector<llist*> lift;
    char c;
    int sz = 1;
    llist (char c) : c(c){}
};

int getsz(llist *l) {
    if(!l) return 0;
    return l->sz;
}

llist *insert(llist* l, char c){
    llist *nl = new llist(c);
    nl->sz = getsz(l)+1;
    if(!l) return nl;
    int i = 0;
    while(l->lift.size() > i){
        nl->lift.pb(l);
        l = l->lift[i++];
    }    
    return nl;
}

char getletter(llist *l, int i){
    FOR(k, 0, 21) if(i & (1<<k)) l = l->lift[k]; 
    return l->c;
}

vector <llist*> v;

void Init() {
    v.pb(0);
}

void TypeLetter(char L) {
    v.pb(insert(v.back(), L));
}

void UndoCommands(int U) {
    v.pb(v[v.size()-1-U]);
}

char GetLetter(int P) {
    auto l = v.back();
    return getletter(l, getsz(l)-1 - P);
}

Compilation message

scrivener.cpp: In function 'llist* insert(llist*, char)':
scrivener.cpp:25:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(l->lift.size() > i){
           ~~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 740 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 208 ms 68144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 18 ms 68144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -