Submission #460402

# Submission time Handle Problem Language Result Execution time Memory
460402 2021-08-09T06:24:16 Z Khizri Rice Hub (IOI11_ricehub) C++17
68 / 100
1000 ms 636 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back		 
#define F first																 
#define S second 															 
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
int besthub(int n, int l, int arr[], long long k)
{
	ll ans=0;
	for(int i=0;i<n;i++){
		int ii=arr[i];
		vector<int>vt;
		for(int j=0;j<n;j++){
			vt.pb(abs(arr[j]-ii));
		}
		sort(all(vt));
		ll x=k,q=0;
		for(int j=0;j<n;j++){
			if(x>=vt[j]){
				x-=vt[j];
				q=j+1;
			}
			else{
				break;
			}
		}
		ans=max(ans,q);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 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 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 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 1 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 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 1 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 4 ms 204 KB Output is correct
22 Correct 5 ms 204 KB Output is correct
23 Correct 7 ms 204 KB Output is correct
24 Correct 7 ms 204 KB Output is correct
25 Correct 6 ms 204 KB Output is correct
26 Correct 6 ms 204 KB Output is correct
27 Correct 6 ms 204 KB Output is correct
28 Correct 6 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 20 ms 312 KB Output is correct
4 Correct 20 ms 324 KB Output is correct
5 Correct 4 ms 204 KB Output is correct
6 Correct 4 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 15 ms 316 KB Output is correct
9 Correct 6 ms 204 KB Output is correct
10 Correct 6 ms 204 KB Output is correct
11 Correct 16 ms 320 KB Output is correct
12 Correct 16 ms 320 KB Output is correct
13 Correct 26 ms 320 KB Output is correct
14 Correct 26 ms 204 KB Output is correct
15 Correct 6 ms 204 KB Output is correct
16 Correct 7 ms 204 KB Output is correct
17 Correct 16 ms 316 KB Output is correct
18 Correct 16 ms 204 KB Output is correct
19 Correct 25 ms 296 KB Output is correct
20 Correct 25 ms 324 KB Output is correct
21 Correct 480 ms 384 KB Output is correct
22 Correct 436 ms 332 KB Output is correct
23 Correct 907 ms 392 KB Output is correct
24 Correct 874 ms 388 KB Output is correct
25 Correct 804 ms 396 KB Output is correct
26 Correct 799 ms 408 KB Output is correct
27 Correct 756 ms 396 KB Output is correct
28 Correct 736 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 636 KB Time limit exceeded
2 Halted 0 ms 0 KB -