답안 #467657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467657 2021-08-24T00:15:11 Z jam_xd_ 쌀 창고 (IOI11_ricehub) C++17
42 / 100
1000 ms 460 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 suma_d=0, campos=0;
	int jamon=0;//auxiliar
 
	for(int i=0;i<R;i++){
        deque<int>diferencias;
		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 break;
		}
		int maximo = max(jamon, campos);
		jamon = maximo;
		suma_d=0;
		campos=0;
		//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:25:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for(int k=0;k<diferencias.size();k++){
      |               ~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 5 ms 204 KB Output is correct
22 Correct 5 ms 204 KB Output is correct
23 Correct 9 ms 304 KB Output is correct
24 Correct 9 ms 204 KB Output is correct
25 Correct 9 ms 204 KB Output is correct
26 Correct 9 ms 304 KB Output is correct
27 Correct 8 ms 204 KB Output is correct
28 Correct 8 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 31 ms 204 KB Output is correct
4 Correct 31 ms 308 KB Output is correct
5 Correct 5 ms 204 KB Output is correct
6 Correct 5 ms 204 KB Output is correct
7 Correct 24 ms 204 KB Output is correct
8 Correct 22 ms 304 KB Output is correct
9 Correct 9 ms 204 KB Output is correct
10 Correct 8 ms 300 KB Output is correct
11 Correct 23 ms 308 KB Output is correct
12 Correct 23 ms 304 KB Output is correct
13 Correct 39 ms 308 KB Output is correct
14 Correct 39 ms 288 KB Output is correct
15 Correct 8 ms 304 KB Output is correct
16 Correct 8 ms 204 KB Output is correct
17 Correct 24 ms 300 KB Output is correct
18 Correct 23 ms 204 KB Output is correct
19 Correct 37 ms 204 KB Output is correct
20 Correct 37 ms 312 KB Output is correct
21 Correct 668 ms 332 KB Output is correct
22 Correct 666 ms 332 KB Output is correct
23 Execution timed out 1086 ms 332 KB Time limit exceeded
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 460 KB Time limit exceeded
2 Halted 0 ms 0 KB -