답안 #232384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232384 2020-05-16T21:55:00 Z jam_xd_ 쌀 창고 (IOI11_ricehub) C++17
42 / 100
1000 ms 640 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)
{
/*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


	deque<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<R;j++){
			int dif=0;
			/*dif = i-X[j];
			  if(dif <= 0)dif = dif * -1;
			*/
			dif = abs(i-X[j]);
			diferencias.push_back(dif);
		}
			sort(diferencias.begin(), diferencias.end());
			

			for(int k=0;k<R;k++){
				if(suma_d + diferencias[k] <= B){
					suma_d = suma_d + diferencias[k];
					campos++;
				}else{
					continue;
				}
			}
				int maximo = max(jamon, campos);
				jamon = maximo;
				diferencias.clear();
				suma_d=0;
				campos=0;
				//comparar anterior y el de ahora 
				//y me quedo con el mayor.
			
	}




  return jamon;
}

Compilation message

ricehub.cpp:52:1: warning: "/*" within comment [-Wcomment]
 /*bool meh;
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 7 ms 256 KB Output is correct
16 Correct 7 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 7 ms 256 KB Output is correct
20 Correct 7 ms 256 KB Output is correct
21 Correct 16 ms 384 KB Output is correct
22 Correct 15 ms 384 KB Output is correct
23 Correct 159 ms 256 KB Output is correct
24 Correct 170 ms 372 KB Output is correct
25 Correct 152 ms 256 KB Output is correct
26 Correct 153 ms 384 KB Output is correct
27 Correct 135 ms 256 KB Output is correct
28 Correct 135 ms 408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 384 KB Output is correct
2 Correct 44 ms 384 KB Output is correct
3 Execution timed out 1091 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -