# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1015503 |
2024-07-06T12:23:57 Z |
KasymK |
Rice Hub (IOI11_ricehub) |
C++17 |
|
1000 ms |
600 KB |
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
int besthub(int r, int l, int x[], ll b){
ll b_ = b;
vector<int> v;
int ans = 0;
for(int hub = 1; hub <= l; ++hub){
int sm = 0;
for(int i = 0; i < r; ++i)
v.pb(abs(hub-x[i]));
sort(v.rbegin(), v.rend());
while(1){
if(b-v.back() >= 0)
b -= v.back(), v.pop_back(), sm++;
else
break;
}
ans = max(ans, sm);
v.clear();
b = b_;
}
return ans;
}
// const int N = 20;
// int a[N];
// int main(){
// int r, l;
// ll b;
// r = 5, l = 20, b = 6;
// a[0] = 1, a[1] = 2, a[2] = 10, a[3] = 12, a[4] = 14;
// printf("%d\n", besthub(r, l, a, b));
// return 0;
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
440 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
11 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
1066 ms |
348 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1039 ms |
600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |