11463 | 2024-09-29 16:56:58 | bzy | Pontos Átlag | cpp17 | Runtime error 60/100 | 96ms | 1384 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k; cin >> n >> k;
long long sum = 0;
vector <int> P(n);
int sum2 = n*k;
for(int i = 0; i < n; i++){
cin >> P[i];
sum += P[i];
}
if(sum2 == sum) cout << 0 << "\n";
else if(sum2 > sum) cout << 1 << "\n";
else{
sort(P.begin(),P.end(),greater<>());
int ans = 0;
int current = 0;
while(sum > sum2){
sum -= P[current] - 1;
current++;
ans++;
}
cout << ans << "\n";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 360 KiB | ||||
2 | Accepted | 3ms | 384 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 3ms | 360 KiB | ||||
4 | Accepted | 3ms | 536 KiB | ||||
5 | Accepted | 3ms | 384 KiB | ||||
6 | Accepted | 3ms | 488 KiB | ||||
7 | Accepted | 3ms | 256 KiB | ||||
8 | Accepted | 3ms | 296 KiB | ||||
9 | Accepted | 3ms | 384 KiB | ||||
10 | Accepted | 2ms | 376 KiB | ||||
11 | Accepted | 2ms | 360 KiB | ||||
12 | Accepted | 3ms | 504 KiB | ||||
13 | Accepted | 2ms | 360 KiB | ||||
subtask3 | 40/40 | ||||||
14 | Accepted | 3ms | 360 KiB | ||||
15 | Accepted | 3ms | 372 KiB | ||||
16 | Accepted | 3ms | 532 KiB | ||||
17 | Accepted | 3ms | 360 KiB | ||||
18 | Accepted | 3ms | 360 KiB | ||||
19 | Accepted | 3ms | 360 KiB | ||||
20 | Accepted | 3ms | 504 KiB | ||||
21 | Accepted | 3ms | 360 KiB | ||||
22 | Accepted | 3ms | 412 KiB | ||||
23 | Accepted | 3ms | 360 KiB | ||||
24 | Accepted | 3ms | 416 KiB | ||||
25 | Accepted | 3ms | 256 KiB | ||||
26 | Accepted | 3ms | 504 KiB | ||||
subtask4 | 0/40 | ||||||
27 | Runtime error | 93ms | 1284 KiB | ||||
28 | Runtime error | 93ms | 1220 KiB | ||||
29 | Partially correct | 93ms | 1260 KiB | ||||
30 | Runtime error | 93ms | 1272 KiB | ||||
31 | Runtime error | 92ms | 1256 KiB | ||||
32 | Runtime error | 93ms | 1256 KiB | ||||
33 | Partially correct | 96ms | 1128 KiB | ||||
34 | Runtime error | 93ms | 1384 KiB | ||||
35 | Runtime error | 93ms | 1256 KiB | ||||
36 | Accepted | 82ms | 1128 KiB | ||||
37 | Wrong answer | 93ms | 1132 KiB | ||||
38 | Accepted | 41ms | 1128 KiB | ||||
39 | Runtime error | 90ms | 1180 KiB | ||||
40 | Runtime error | 90ms | 1128 KiB | ||||
41 | Runtime error | 68ms | 1256 KiB | ||||
42 | Runtime error | 93ms | 1312 KiB | ||||
43 | Accepted | 61ms | 1128 KiB |