#include <bits/stdc++.h>
using namespace std;
#define ll long long
map <int, int> m;
vector <int> v;
int besthub(int R, int L, int X[], ll B) {
for (int i = 0; i < R; ++i) {
m[X[i]]++;
}
int jog = 0, ans;
ll op;
for (int i = 1; i <= L; ++i) {
op = 0;
ans = 0;
for (int j = 1; j <= L; ++j) {
if (m.find (j) != m.end()) {
for (int k = 1; k <= m[j]; ++k) v.push_back ({abs (i - j)});
}
}
sort (v.begin(), v.end());
for (int i : v) {
op += i;
if (op > B) break;
ans++;
}
jog = max (jog, ans);
v.clear();
}
return jog;
}
//int main() {
// freopen("kk.txt", "r", stdin);
// int R, L;
// ll B;
// cin >> R >> L >> B;
// int X[R];
// for (int i = 0; i < R; ++i) {
// cin >> X[i];
// }
// cout << besthub (R, L, X, B);
//}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
212 KB |
Output is correct |
6 |
Correct |
9 ms |
212 KB |
Output is correct |
7 |
Correct |
11 ms |
308 KB |
Output is correct |
8 |
Correct |
11 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 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 |
14 ms |
308 KB |
Output is correct |
16 |
Correct |
14 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 |
12 ms |
308 KB |
Output is correct |
20 |
Correct |
11 ms |
212 KB |
Output is correct |
21 |
Correct |
12 ms |
212 KB |
Output is correct |
22 |
Correct |
12 ms |
312 KB |
Output is correct |
23 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
762 ms |
296 KB |
Output is correct |
2 |
Correct |
779 ms |
300 KB |
Output is correct |
3 |
Execution timed out |
1055 ms |
340 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1068 ms |
1492 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |