Submission #467654

# Submission time Handle Problem Language Result Execution time Memory
467654 2021-08-24T00:14:00 Z jam_xd_ Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#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;
}

Compilation message

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;
      |          ^~~~~