제출 #477284

#제출 시각아이디문제언어결과실행 시간메모리
477284TsiannisTraffic (IOI10_traffic)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define INF 100000000000 typedef long long ll; int main() { ll N; cin>>N; ll sum=0; ll P[N],D[N],S[N],pre[N]; for (int i=0;i<N;i++) { cin>>P[i]; sum+=P[i]; pre[i]=sum; } for (int i=0;i<N-1;i++) { cin>>S[i]>>D[i]; } ll mn=INF; ll index; ll d=sum/2; for (int i=0;i<N;i++) { ll d=(sum-P[i])/2; if (abs(pre[i]-d-P[i])<mn) { mn=abs(pre[i]-d-P[i]); index=i; } } cout<<index<<endl; return 0; }

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

traffic.cpp: In function 'int main()':
traffic.cpp:23:8: warning: unused variable 'd' [-Wunused-variable]
   23 |     ll d=sum/2;
      |        ^
/usr/bin/ld: /tmp/cc5Ys0gb.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccHHHF1c.o:traffic.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc5Ys0gb.o: in function `main':
grader.cpp:(.text.startup+0xe1): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status