제출 #377699

#제출 시각아이디문제언어결과실행 시간메모리
377699AlexRex0Traffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
#include <stdio.h> #include <bits/stdc++.h> using namespace std; long long int a[1000002]; static int N,P[1000000],S[1000000],D[1000000]; int LocateCentre(int N, int pp[], int S[], int D[]) { int res = 0; long long int menor = 2000000000000001; a[0] = 0; a[N + 1] = 0; for(int i = 1; i <= N; ++i){ a[i] = pp[i - 1] + a[i - 1]; } for(int i = 2; i < N; ++i){ long long int aux = a[N] - a[i]; long long int aux2 = a[i - 1]; aux = max(aux, aux2); if(aux < menor){ menor = aux; res = i; } } long long int aux = 0; aux = a[N] - a[1]; if(aux < menor){ menor = aux; res = 1; } aux = a[N - 1]; if(aux < menor){ menor = aux; res = N; } res--; return res; } int main(){ int i; scanf("%d",&N); for (i=0;i<N;i++) scanf("%d",&P[i]); for (i=0;i<N-1;i++) scanf("%d%d",&S[i],&D[i]); int r = LocateCentre(N,P,S,D); printf("%d\n",r); return 0; }

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

traffic.cpp: In function 'int main()':
traffic.cpp:39:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   39 |    scanf("%d",&N);
      |    ~~~~~^~~~~~~~~
traffic.cpp:40:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   40 |    for (i=0;i<N;i++) scanf("%d",&P[i]);
      |                      ~~~~~^~~~~~~~~~~~
traffic.cpp:41:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   41 |    for (i=0;i<N-1;i++) scanf("%d%d",&S[i],&D[i]);
      |                        ~~~~~^~~~~~~~~~~~~~~~~~~~
/tmp/ccpLCgpZ.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccUr2EC7.o:traffic.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status