답안 #467653

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467653 2021-08-24T00:06:19 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)
{
	deque<long long>diferencias;
	int suma_d=0, campos=0;
	int jamon=0;//auxiliar
 
	for(int i=0;i<R;i++){
		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;
		diferencias.clear();
		suma_d=0;
		campos=0;
			
	}
    
  return jamon;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:24:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for(int k=0;k<diferencias.size();k++){
      |               ~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 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 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 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 1 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 6 ms 300 KB Output is correct
22 Correct 6 ms 204 KB Output is correct
23 Correct 9 ms 204 KB Output is correct
24 Correct 10 ms 296 KB Output is correct
25 Correct 9 ms 204 KB Output is correct
26 Correct 9 ms 304 KB Output is correct
27 Correct 9 ms 204 KB Output is correct
28 Correct 9 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 32 ms 296 KB Output is correct
4 Correct 32 ms 204 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 312 KB Output is correct
8 Correct 24 ms 276 KB Output is correct
9 Correct 9 ms 300 KB Output is correct
10 Correct 11 ms 300 KB Output is correct
11 Correct 24 ms 204 KB Output is correct
12 Correct 24 ms 204 KB Output is correct
13 Correct 39 ms 204 KB Output is correct
14 Correct 38 ms 204 KB Output is correct
15 Correct 9 ms 332 KB Output is correct
16 Correct 9 ms 204 KB Output is correct
17 Correct 23 ms 204 KB Output is correct
18 Correct 23 ms 204 KB Output is correct
19 Correct 37 ms 312 KB Output is correct
20 Correct 38 ms 204 KB Output is correct
21 Correct 707 ms 332 KB Output is correct
22 Correct 705 ms 352 KB Output is correct
23 Execution timed out 1089 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 -