제출 #655200

#제출 시각아이디문제언어결과실행 시간메모리
655200Trumling쌀 창고 (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
#include "ricehub.h" #include<iostream> #include<cmath> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; int besthub(int R, int L, int X[], long long B) { bool arr[L+1]={ }; for(int i=0;i<R;i++) { arr[X[i]]=true; } ll ans=1; ll count=0; ll plus=R; while(plus!=1) { if(ans!=1) break; for(int i=0;i<=R-plus;i++) { ll med=(i+i+plus)/2; ll curr=0; for(int j=i;j<i+plus;j++) curr+=abs(X[med]-X[j]); if(curr<=B) { ans=plus; break; } } plus--; } //cout<<'\n'<<ans<<'\n'; return ans; } #include "ricehub.h" #include <stdio.h> #include <stdlib.h> #define MAX_R 1000000 static int R, L; static long long B; static int X[MAX_R]; static int solution; inline void my_assert(int e) {if (!e) abort();} static void read_input() { int i; my_assert(3==scanf("%d %d %lld",&R,&L,&B)); for(i=0; i<R; i++) my_assert(1==scanf("%d",&X[i])); my_assert(1==scanf("%d",&solution)); } int main() { ll anse; read_input(); anse = besthub(R,L,X,B); if(anse==solution) printf("Correct.\n"); else printf("Incorrect. Returned %d instead of %d.\n",anse,solution); return 0; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:20:4: warning: unused variable 'count' [-Wunused-variable]
   20 | ll count=0;
      |    ^~~~~
ricehub.cpp: In function 'int main()':
ricehub.cpp:76:35: warning: format '%d' expects argument of type 'int', but argument 2 has type 'll' {aka 'long long int'} [-Wformat=]
   76 |     printf("Incorrect.  Returned %d instead of %d.\n",anse,solution);
      |                                  ~^                   ~~~~
      |                                   |                   |
      |                                   int                 ll {aka long long int}
      |                                  %lld
/usr/bin/ld: /tmp/ccTn3YEP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc4WjeNP.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status