제출 #1013057

#제출 시각아이디문제언어결과실행 시간메모리
1013057parsadox2동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <bits/stdc++.h> #define MAX_N 5000 #define MAX_CALLS 70000 using namespace std; static int N; static int realS[MAX_N]; static int realD[MAX_N]; static int inv[MAX_N]; static int num_calls; void answer(int S[], int D[]) { int i; for (i = 0; i < N; ++i) if (S[i] != realS[i] || D[i] != realD[i]) { printf("INCORRECT\nWrong answer:"); if (S[i] != realS[i]) printf("S[%d] != realS[%d]", i, i); else printf("D[%d] != realD[%d]", i, i); exit(0); } printf("CORRECT\n"); exit(0); } int tryCombination(int S[]) { int i; if (num_calls >= MAX_CALLS) { printf("INCORRECT\nToo many calls to tryCombination().\n"); exit(0); } ++num_calls; //for(int i = 0 ; i < N ; i++) // cout << S[i] << endl; for (i = 0; i < N; ++i) if (S[inv[i]] != realS[inv[i]]) return i; return -1; } int init() { int i; assert(scanf("%d", &N) == 1); for (i = 0; i < N; ++i) { assert(scanf("%d", &realS[i]) == 1); } for (i = 0; i < N; ++i) { assert(scanf("%d", &realD[i]) == 1); inv[realD[i]] = i; } num_calls = 0; return N; } int main() { int N; N = init(); exploreCave(N); printf("INCORRECT\nYour solution did not call answer().\n"); return 0; }

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

/usr/bin/ld: /tmp/cchyqlyc.o: in function `answer':
cave.cpp:(.text+0x0): multiple definition of `answer'; /tmp/ccGdcKXc.o:grader.c:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cchyqlyc.o: in function `tryCombination':
cave.cpp:(.text+0xc0): multiple definition of `tryCombination'; /tmp/ccGdcKXc.o:grader.c:(.text+0x80): first defined here
/usr/bin/ld: /tmp/cchyqlyc.o: in function `init()':
cave.cpp:(.text+0x150): multiple definition of `init()'; /tmp/ccGdcKXc.o:grader.c:(.text+0x110): first defined here
/usr/bin/ld: /tmp/cchyqlyc.o: in function `main':
cave.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccGdcKXc.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccGdcKXc.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
/usr/bin/ld: /tmp/cchyqlyc.o: in function `main':
cave.cpp:(.text.startup+0x10): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status