제출 #587390

#제출 시각아이디문제언어결과실행 시간메모리
587390GioChkhaidze크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int Tries,idx,q,D[1000006],dep[1000006],T[1000006][37]; int P[1000006][21]; char C[1000006]; main () { ios::sync_with_stdio(false); cin.tie(NULL); Tries=1; cin>>q; int Nowidx=1; D[0]=Nowidx; dep[Nowidx]=0; while (q--) { char c; int x; cin>>c; if (c=='T') { cin>>c; idx++; int t=c-'a'; if (!T[Nowidx][t]) { T[Nowidx][t]=++Tries; C[Tries]=c; dep[T[Nowidx][t]]=dep[Nowidx]+1; P[T[Nowidx][t]][0]=Nowidx; for (int j=1; j<=20; j++) P[T[Nowidx][t]][j]=P[P[T[Nowidx][t]][j-1]][j-1]; } D[idx]=T[Nowidx][t]; Nowidx=D[idx]; } else if (c=='U') { cin>>x; idx++; D[idx]=D[idx-x-1]; Nowidx=D[idx]; } else if (c=='P') { cin>>x; x++; int Nq=Nowidx; if (dep[Nq]==x) { cout<<C[Nq]<<"\n"; continue; } for (int i=20; i>=0; i--) if (dep[P[Nq][i]]>x) Nq=P[Nq][i]; Nq=P[Nq][0]; cout<<C[Nq]<<"\n"; } } }

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

scrivener.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main () {
      | ^~~~
/usr/bin/ld: /tmp/ccBKHGvw.o: in function `main':
scrivener.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccbH4kGs.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccbH4kGs.o: in function `main':
grader.cpp:(.text.startup+0x63): undefined reference to `Init()'
/usr/bin/ld: grader.cpp:(.text.startup+0xff): undefined reference to `TypeLetter(char)'
/usr/bin/ld: grader.cpp:(.text.startup+0x15f): undefined reference to `UndoCommands(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x18b): undefined reference to `GetLetter(int)'
collect2: error: ld returned 1 exit status