-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Recycling_Center.cpp
More file actions
56 lines (44 loc) · 924 Bytes
/
A_Recycling_Center.cpp
File metadata and controls
56 lines (44 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define pb push_back
#define mp make_pair
const int N = int(3e5) + 999;
const int MOD = 998244353;
int p2[N];
void solve() {
int n, c;
cin >> n >> c;
vector<ll> v;
for (int i = 0; i < n; i++) {
ll x;
cin >> x;
if (x <= c) {
v.push_back(x);
}
}
int ans = n - v.size();
sort(v.begin(), v.end(), greater<ll>());
int count = 0;
for (int i = 0; i < v.size(); i++) {
if (count >= N) break;
if (v[i] * (1LL << count) > c) {
ans++;
} else {
count++;
}
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
p2[0] = 1;
for (int i = 1; i < N; ++i)
p2[i] = (2LL * p2[i - 1]) % MOD;
int tc;
cin >> tc;
while (tc--) {
solve();
}
}