제출 #467654

#제출 시각아이디문제언어결과실행 시간메모리
467654jam_xd_쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; //si solo era esto me muero >:v. int besthub(int R, int L, int X[], long long B) { for(int i=0;i<R;i++){ deque<int>diferencias; int suma_d=0, campos=0; int jamon=0;//auxiliar for(int j=0;j<R;j++){ int dif=0; /*dif = i-X[j]; if(dif <= 0)dif = dif * -1; */ dif = abs(X[i]-X[j]); diferencias.push_back(dif); } sort(diferencias.begin(), diferencias.end()); for(int k=0;k<diferencias.size();k++){ if(suma_d + diferencias[k] <= B){ suma_d = suma_d + diferencias[k]; campos++; }else continue; } int maximo = max(jamon, campos); jamon = maximo; //comparar anterior y el de ahora //y me quedo con el mayor. } return jamon; }

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int k=0;k<diferencias.size();k++){
      |               ~^~~~~~~~~~~~~~~~~~~
ricehub.cpp:40:10: error: 'jamon' was not declared in this scope
   40 |   return jamon;
      |          ^~~~~