제출 #547120

#제출 시각아이디문제언어결과실행 시간메모리
547120oToToT크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
컴파일 에러
0 ms0 KiB
#include <ext/rope> __gnu_cxx::crope a[1000001]; int cnt; void Init() { cnt = 0; } void TypeLetter(char c) { a[++cnt] = a[cnt] + c; } void UndoCommands(int k) { arr[++cnt]=arr[cnt-k-1]; } char GetLetter(int k){ return arr[cnt][k]; }

컴파일 시 표준 에러 (stderr) 메시지

scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:7:29: warning: operation on 'cnt' may be undefined [-Wsequence-point]
    7 | void TypeLetter(char c) { a[++cnt] = a[cnt] + c; }
      |                             ^~~~~
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:8:28: error: 'arr' was not declared in this scope
    8 | void UndoCommands(int k) { arr[++cnt]=arr[cnt-k-1]; }
      |                            ^~~
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:9:31: error: 'arr' was not declared in this scope
    9 | char GetLetter(int k){ return arr[cnt][k]; }
      |                               ^~~