제출 #898130

#제출 시각아이디문제언어결과실행 시간메모리
898130math_rabbit_1028Triangles (CEOI18_tri)C++14
컴파일 에러
0 ms0 KiB
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "trilib.h" static int n; static long long *x, *y; static int queries=0; static void init() { static int is_inited=0; if (is_inited) return; is_inited=1; assert(scanf("%d", &n)==1); x=(long long*)malloc((n+1)*sizeof(long long)); y=(long long*)malloc((n+1)*sizeof(long long)); for (int i=1; i<=n; i++) assert(scanf("%lld%lld", &x[i], &y[i])==2); } int get_n() { init(); return n; } int is_clockwise(int a, int b, int c) { init(); assert(a>=1 && a<=n); assert(b>=1 && b<=n); assert(c>=1 && c<=n); assert(a!=b && a!=c && b!=c); queries++; if(queries == 1000 * 1000 + 1) printf("Too many queries!"); return (x[b]-x[a])*(y[c]-y[a])-(x[c]-x[a])*(y[b]-y[a])<0; } void give_answer(int s) { init(); printf("%d\n", s); }

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

/usr/bin/ld: /tmp/ccnR0nX9.o: in function `get_n':
tri.cpp:(.text+0x120): multiple definition of `get_n'; /tmp/ccajE7W5.o:trilib.c:(.text+0x120): first defined here
/usr/bin/ld: /tmp/ccnR0nX9.o: in function `is_clockwise':
tri.cpp:(.text+0x190): multiple definition of `is_clockwise'; /tmp/ccajE7W5.o:trilib.c:(.text+0x190): first defined here
/usr/bin/ld: /tmp/ccnR0nX9.o: in function `give_answer':
tri.cpp:(.text+0x2f0): multiple definition of `give_answer'; /tmp/ccajE7W5.o:trilib.c:(.text+0x2f0): first defined here
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status