Submission #261643

# Submission time Handle Problem Language Result Execution time Memory
261643 2020-08-11T23:25:48 Z c4ts0up Rice Hub (IOI11_ricehub) C++17
42 / 100
1000 ms 1420 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n;
vector <ll> arr;

ll RO(ll budget, ll cord) {
	priority_queue <ll, vector <ll>, greater <ll> > pq;
	
	for (ll x : arr) pq.push(abs(x-cord));
	
	ll paks = 0, suma = 0;
	
	while (!pq.empty() && suma <= budget) {
		ll curr = pq.top();
		pq.pop();
		
		if (suma + curr <= budget) suma += curr, paks++;
		else break;
	}
	
	return paks;
}
 
int besthub(int R, int L, int X[], ll B) {
	for (ll i=0; i<R; i++) arr.push_back((ll)X[i]);
	
	ll maxi = 0;
	for (ll i=1; i<=L; i++) {
		maxi = max(maxi, RO(B, i));
	}
	return maxi;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 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 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 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 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 9 ms 384 KB Output is correct
22 Correct 10 ms 512 KB Output is correct
23 Correct 247 ms 504 KB Output is correct
24 Correct 244 ms 384 KB Output is correct
25 Correct 242 ms 504 KB Output is correct
26 Correct 245 ms 504 KB Output is correct
27 Correct 131 ms 504 KB Output is correct
28 Correct 132 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 376 KB Output is correct
2 Correct 34 ms 384 KB Output is correct
3 Execution timed out 1093 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 1420 KB Time limit exceeded
2 Halted 0 ms 0 KB -