-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpickleclicker-20p.cpp
More file actions
54 lines (42 loc) · 977 Bytes
/
pickleclicker-20p.cpp
File metadata and controls
54 lines (42 loc) · 977 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
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, high) for (int i = 0; i < high; i++)
#define repp(i, low, high) for (int i = low; i < high; i++)
#define sz(container) ((int)container.size())
#define all(x) begin(x), end(x)
void fast() {
ios::sync_with_stdio(0);
cin.tie(0);
}
ll n, t;
ll best_time = 1e7;
vector<pair<ll, ll>> buildings;
void rec(ll pickles, ll pps, ll time) {
pickles += pps;
time += 1;
if (best_time <= time) {
return;
}
if (t <= pickles) {
best_time = time;
return;
}
rec(pickles, pps, time);
for (pair<ll, ll> building : buildings) {
if (building.second <= pickles) {
rec(pickles - building.second, pps + building.first, time);
}
}
}
int main() {
fast();
cin >> n >> t;
buildings.resize(n);
for (ll i = 0; i < n; i++) {
cin >> buildings[i].first >> buildings[i].second;
}
rec(0, buildings[0].first, 0);
cout << best_time << endl;
return 0;
}