제출 #412094

#제출 시각아이디문제언어결과실행 시간메모리
412094losmi247동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; const int N = 5002; int n; int *prvi,*drugi; int *kojisvic; int tryCombination(int *S){ for(int i = 0; i < n; i++){ if(S[i] != prvi[kojisvic[i]]) return i; } return -1; } void answer(int *S,int *D){ for(int i = 0; i < n; i++){ if(S[i] != prvi[i]){ cout << "WA1" << endl; exit(0); } } for(int i = 0; i < n; i++){ if(D[i] != drugi[i]){ cout << "WA2" << endl; exit(0); } } cout << "OK" << endl; } void znamred(){ int *niz = (int*)malloc(sizeof(int)*n); int *odg1 = (int*)malloc(sizeof(int)*n); for(int i = 0; i < n; i++){ niz[i] = 0; odg1[i] = i; } while(1){ int x = tryCombination(niz); if(x == -1) break; niz[x] ^= 1; } answer(niz,odg1); } void exploreCave(int br){ n = br; znamred(); } /*int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int gh; cin >> gh; prvi = (int*)malloc(sizeof(int)*gh); drugi = (int*)malloc(sizeof(int)*gh); kojisvic = (int*)malloc(sizeof(int)*gh); for(int i = 0; i < gh; i++) cin >> prvi[i]; for(int i = 0; i < gh; i++){ cin >> drugi[i]; kojisvic[drugi[i]] = i; } exploreCave(gh); }*/

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

/usr/bin/ld: /tmp/ccPnNWWj.o: in function `tryCombination':
cave.cpp:(.text+0x0): multiple definition of `tryCombination'; /tmp/ccVxLOvi.o:grader.c:(.text+0x80): first defined here
/usr/bin/ld: /tmp/ccPnNWWj.o: in function `answer':
cave.cpp:(.text+0x60): multiple definition of `answer'; /tmp/ccVxLOvi.o:grader.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status