답안 #104063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
104063 2019-04-03T21:08:38 Z wilwxk 쌀 창고 (IOI11_ricehub) C++11
42 / 100
1000 ms 1080 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAXN=1e5+3;
int v[MAXN];
int n, m;
ll x;

int testa(ll k) {
	vector<int> aux;
	for(int i=0; i<n; i++) aux.push_back(abs(v[i]-k));
	sort(aux.begin(), aux.end());
	int soma=0; int resp=0;
	for(auto cur : aux) {
		if(soma+cur<=x) {
			soma+=cur;
			resp++;
		}
		else {
			break;
		}
	}
	return resp;
}

int besthub(int N, int M, int V[], ll X)
{

	n=N; m=M; x=X;
	for(int i=0; i<n; i++) v[i]=V[i];

	int resp=0;
	for(int i=0; i<=m; i++) resp=max(resp, testa(i));

	return resp;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 316 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 17 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 6 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 8 ms 384 KB Output is correct
22 Correct 9 ms 384 KB Output is correct
23 Correct 92 ms 384 KB Output is correct
24 Correct 95 ms 376 KB Output is correct
25 Correct 112 ms 384 KB Output is correct
26 Correct 93 ms 384 KB Output is correct
27 Correct 82 ms 376 KB Output is correct
28 Correct 82 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 384 KB Output is correct
2 Correct 26 ms 376 KB Output is correct
3 Execution timed out 1082 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 1080 KB Time limit exceeded
2 Halted 0 ms 0 KB -