# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
705917 | 2023-03-05T15:57:26 Z | Alihan_8 | Rice Hub (IOI11_ricehub) | C++17 | 1000 ms | 996 KB |
#include <bits/stdc++.h> #include "ricehub.h" // include <ext/pb_ds/assoc_container.hpp> // include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define all(x) x.begin(), x.end() #define pb push_back // define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> #define mpr make_pair #define ln '\n' void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} //#define int long long typedef long long ll; int besthub(int R, int L, int X[], ll B){ int n = R; ll Mx = 0; for ( int pos = 0; pos <= L; pos++ ){ vector <int> res; for ( int i = 0; i < n; i++ ){ res.pb(abs(X[i]-pos)); } sort(all(res)); ll sum = 0, cnt = 0; for ( auto i: res ){ if ( sum+i > B ) break; cnt++, sum += i; } Mx = max(Mx, cnt); } return Mx; } #if false signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int R, L, B; cin >> R >> L >> B; int X[R]; for ( int i = 0; i < R; i++ ) cin >> X[i]; cout << besthub(R, L, X, B); cout << '\n'; /* 5 20 6 1 2 10 12 14 answer: 3 */ } #endif
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 308 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 2 ms | 212 KB | Output is correct |
7 | Correct | 2 ms | 312 KB | Output is correct |
8 | Correct | 2 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 2 ms | 212 KB | Output is correct |
16 | Correct | 2 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 2 ms | 212 KB | Output is correct |
20 | Correct | 2 ms | 212 KB | Output is correct |
21 | Correct | 6 ms | 212 KB | Output is correct |
22 | Correct | 6 ms | 316 KB | Output is correct |
23 | Correct | 92 ms | 212 KB | Output is correct |
24 | Correct | 97 ms | 296 KB | Output is correct |
25 | Correct | 90 ms | 212 KB | Output is correct |
26 | Correct | 88 ms | 212 KB | Output is correct |
27 | Correct | 75 ms | 212 KB | Output is correct |
28 | Correct | 75 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 212 KB | Output is correct |
2 | Correct | 22 ms | 212 KB | Output is correct |
3 | Execution timed out | 1073 ms | 212 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1065 ms | 996 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |