Submission #307702

# Submission time Handle Problem Language Result Execution time Memory
307702 2020-09-29T07:02:23 Z tengiz05 Rice Hub (IOI11_ricehub) C++17
43 / 100
1000 ms 1164 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int a[N], n;
long long b;
int check(int pos){
	vector<int> v;
	for(int i=0;i<n;i++){
		v.push_back(abs(a[i]-pos));
	}sort(v.begin(), v.end());
	int i=0;
	long long B = b;
	int cnt = 0;
	while(i < n && B > 0){
		if(v[i] > B)break;
		B -= (long long)v[i], i++;
		cnt++;
	}return cnt;
}
int besthub(int R, int L, int X[], long long B){
	n = R;
	b = B;
	for(int i=0;i<n;i++)a[i] = X[i];
	int ans = 0;
	for(int i=0;i<n;i++){
		ans = max(check(a[i]), ans);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 372 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 21 ms 384 KB Output is correct
4 Correct 21 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 14 ms 384 KB Output is correct
8 Correct 14 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 17 ms 384 KB Output is correct
12 Correct 16 ms 384 KB Output is correct
13 Correct 26 ms 384 KB Output is correct
14 Correct 26 ms 512 KB Output is correct
15 Correct 7 ms 384 KB Output is correct
16 Correct 9 ms 380 KB Output is correct
17 Correct 16 ms 380 KB Output is correct
18 Correct 16 ms 384 KB Output is correct
19 Correct 25 ms 384 KB Output is correct
20 Correct 26 ms 384 KB Output is correct
21 Correct 399 ms 496 KB Output is correct
22 Correct 405 ms 504 KB Output is correct
23 Correct 854 ms 504 KB Output is correct
24 Correct 871 ms 504 KB Output is correct
25 Correct 808 ms 632 KB Output is correct
26 Correct 797 ms 632 KB Output is correct
27 Correct 728 ms 512 KB Output is correct
28 Correct 726 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 1164 KB Time limit exceeded
2 Halted 0 ms 0 KB -