답안 #232372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232372 2020-05-16T21:27:27 Z jam_xd_ 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
int besthub(int R, int L, int X[], long long B)
{
/*int rhub = 1,RP;//thub=0;

int operaciones = 0, c_hub=0;

vector<int>dinamic_multiset;

for(int i=0;i<X.size();i++){
	if(rhub <= X[i]){
		for(int j=X[i];j>=rhub;j++){
			operaciones++;

			if(operaciones >= B){
				dinamic_multiset.push_back(c_hub);
				operaciones=0;
				c_hub=0;
				break;
			}
		}
		c_hub++;

	
	}

	if(rhub >= X[i]){
		for(int j=X[i];j<=rhub;j++){
			operaciones++;

			if(operaciones>=B){
				dinamic_multiset.push_back(c_hub);
				operaciones = 0;
				c_hub=0;
				break;
    		}
		}
		c_hub++;
	
	}
}
sort(dinamic_multiset.begin(), dinamic_multiset.end());


cout<<dinamic_multiset[dinamic_multiset.size()-1];

/*bool meh;
for(it = dinamic_multiset.begin(),meh!=true;it++)
	if(it == dinamic_multiset.end()){
		RP = (*it);
		break;
	}
}*/
/////////////////////////////////////////////////////////////////////

	/*for(int i=1;i<=L;i++){

	}*/
/////////NO FURULA :"V ASI QUE BAMOA HACER DESDE 0 Bv


	vector<long long>diferencias;
	int suma_d=0, campos=0;
	int jamon=0;//auxiliar

	for(int i=1;i<=L;i++){
		for(int j=0;j<X.size();j++){
			int dif=0;
			/*dif = i-X[j];
			  if(dif <= 0)dif = dif * -1;
			*/
		}

			dif = abs(i-X[j]);
			diferencias.push_back(dif);

			for(int k=0;k<X.size();k++){
				if(suma_d + V[j] <= B){
					suma_d = suma_d + V[j];
					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:48:1: warning: "/*" within comment [-Wcomment]
 /*bool meh;
  
ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:63:2: error: 'vector' was not declared in this scope
  vector<long long>diferencias;
  ^~~~~~
ricehub.cpp:63:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
ricehub.cpp:63:9: error: expected primary-expression before 'long'
  vector<long long>diferencias;
         ^~~~
ricehub.cpp:68:19: error: request for member 'size' in 'X', which is of non-class type 'int*'
   for(int j=0;j<X.size();j++){
                   ^~~~
ricehub.cpp:69:8: warning: unused variable 'dif' [-Wunused-variable]
    int dif=0;
        ^~~
ricehub.cpp:75:4: error: 'dif' was not declared in this scope
    dif = abs(i-X[j]);
    ^~~
ricehub.cpp:75:4: note: suggested alternative: 'div'
    dif = abs(i-X[j]);
    ^~~
    div
ricehub.cpp:75:18: error: 'j' was not declared in this scope
    dif = abs(i-X[j]);
                  ^
ricehub.cpp:76:4: error: 'diferencias' was not declared in this scope
    diferencias.push_back(dif);
    ^~~~~~~~~~~
ricehub.cpp:78:20: error: request for member 'size' in 'X', which is of non-class type 'int*'
    for(int k=0;k<X.size();k++){
                    ^~~~
ricehub.cpp:79:17: error: 'V' was not declared in this scope
     if(suma_d + V[j] <= B){
                 ^
ricehub.cpp:86:18: error: 'max' was not declared in this scope
     int maximo = max(jamon, campos);
                  ^~~
ricehub.cpp:86:18: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~