# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
856093 |
2023-10-02T16:33:56 Z |
aykhn |
Rice Hub (IOI11_ricehub) |
C++14 |
|
1000 ms |
880 KB |
#include "ricehub.h"
#include <bits/stdc++.h>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
int besthub(int n, int l, int x[], long long b)
{
int ans = 1;
for (int i = 0; i < n; i++)
{
vector<int> v;
for (int j = 0; j < n; j++)
{
v.pb(abs(x[j] - x[i]));
}
sort(all(v));
int cnt = 0;
int sum = 0;
for (int j = 0; j < n; j++)
{
if (sum + v[j] <= b)
{
cnt++;
sum += v[j];
}
else break;
}
ans = max(ans, cnt);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
444 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
448 KB |
Output is correct |
15 |
Correct |
1 ms |
448 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
452 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
3 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
344 KB |
Output is correct |
23 |
Correct |
5 ms |
348 KB |
Output is correct |
24 |
Correct |
6 ms |
456 KB |
Output is correct |
25 |
Correct |
5 ms |
348 KB |
Output is correct |
26 |
Correct |
5 ms |
344 KB |
Output is correct |
27 |
Correct |
4 ms |
348 KB |
Output is correct |
28 |
Correct |
5 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
344 KB |
Output is correct |
4 |
Correct |
14 ms |
464 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
452 KB |
Output is correct |
7 |
Correct |
15 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
10 |
Correct |
6 ms |
348 KB |
Output is correct |
11 |
Correct |
11 ms |
348 KB |
Output is correct |
12 |
Correct |
11 ms |
344 KB |
Output is correct |
13 |
Correct |
26 ms |
452 KB |
Output is correct |
14 |
Correct |
18 ms |
348 KB |
Output is correct |
15 |
Correct |
5 ms |
348 KB |
Output is correct |
16 |
Correct |
4 ms |
452 KB |
Output is correct |
17 |
Correct |
11 ms |
348 KB |
Output is correct |
18 |
Correct |
11 ms |
348 KB |
Output is correct |
19 |
Correct |
17 ms |
448 KB |
Output is correct |
20 |
Correct |
18 ms |
604 KB |
Output is correct |
21 |
Correct |
294 ms |
348 KB |
Output is correct |
22 |
Correct |
282 ms |
516 KB |
Output is correct |
23 |
Correct |
629 ms |
528 KB |
Output is correct |
24 |
Correct |
643 ms |
540 KB |
Output is correct |
25 |
Correct |
574 ms |
544 KB |
Output is correct |
26 |
Correct |
691 ms |
540 KB |
Output is correct |
27 |
Correct |
551 ms |
348 KB |
Output is correct |
28 |
Correct |
534 ms |
536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
880 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |