Submission #72082

#TimeUsernameProblemLanguageResultExecution timeMemory
72082BOJ 8481 (#118)Key of Impassable Doors (FXCUP3_key)C++17
Compilation error
0 ms0 KiB
#include <stdio.h> #include <stdlib.h> #include "key.h" static int N, in[1010]; static void my_assert(int TF, const char* message){ if(!TF){ puts(message); exit(1); } } static int call_cnt = 0, chk[1010]; void TakeKey(int K){ my_assert(1 <= K && K <= N, "Wrong : Invalid K"); my_assert(!chk[K], "Wrong : K Already Exists"); chk[K] = 1; } static int go[1010]; int Explore(){ call_cnt++; my_assert(call_cnt <= 10000, "Wrong : Too Much Calls"); int gcn = 0; for(int i=1; i<=N; i++) go[i] = 0; for(int i=1; i<=N; i++){ if(!chk[i]) continue; for(int j=i; !go[j]; j=in[j]) go[j] = 1, gcn++; chk[i] = 0; } return gcn; } static int can_go[1010][1010], pair_cnt; void Report(int Key, int Room){ my_assert(1 <= Key && Key <= N && 1 <= Room && Room <= N, "Wrong : Invalid Key, Room"); my_assert(can_go[Key][Room], "Wrong : Cannot Go Key->Room"); my_assert(can_go[Key][Room]!=2, "Wrong : Duplicate Argument"); can_go[Key][Room] = 2; pair_cnt--; } int main(){ my_assert(scanf("%d", &N) == 1, "Error: Invalid Input"); my_assert(1 <= N && N <= 1000, "Error: Invalid Input"); for(int i=1; i<=N; i++){ my_assert(scanf("%d", &in[i]), "Error: Invalid Input"); my_assert(1 <= in[i] && in[i] <= N, "Error: Invalid Input"); } for(int i=1; i<=N; i++){ for(int j=i; !go[j]; j=in[j]) go[j] = can_go[i][j] = 1, pair_cnt++; for(int j=i; go[j]; j=in[j]) go[j] = 0; } EnsureKeyInfo(N); my_assert(pair_cnt == 0, "Wrong : Did Not Call All Pairs"); printf("Correct\n%d\n", call_cnt); return 0; }

Compilation message (stderr)

/tmp/cc4Ob5J5.o: In function `Explore()':
grader.cpp:(.text+0x20): multiple definition of `Explore()'
/tmp/ccbTOfc0.o:key.cpp:(.text+0x70): first defined here
/tmp/cc4Ob5J5.o: In function `Report(int, int)':
grader.cpp:(.text+0xf0): multiple definition of `Report(int, int)'
/tmp/ccbTOfc0.o:key.cpp:(.text+0x140): first defined here
/tmp/cc4Ob5J5.o: In function `TakeKey(int)':
grader.cpp:(.text+0x170): multiple definition of `TakeKey(int)'
/tmp/ccbTOfc0.o:key.cpp:(.text+0x20): first defined here
/tmp/cc4Ob5J5.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccbTOfc0.o:key.cpp:(.text.startup+0x0): first defined here
/tmp/ccbTOfc0.o: In function `main':
key.cpp:(.text.startup+0x12b): undefined reference to `EnsureKeyInfo(int)'
/tmp/cc4Ob5J5.o: In function `main':
grader.cpp:(.text.startup+0x13b): undefined reference to `EnsureKeyInfo(int)'
collect2: error: ld returned 1 exit status