This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
signed main() {
ll n, T, ans = 0;
cin >> n >> T;
vector<ll> h(n), g(n);
for(int i=0; i<n; i++) cin >> h[i] >> g[i];
for(int s=1; s<(1<<n); s++) {
ll sum = 0, last = -1, ok = 1;
for(int i=0; i<n; i++) {
if(s & (1 << i)) {
sum += g[i];
if(last > -1 && h[last] > h[i]) ok = 0;
last = i;
}
}
if(ok) ans += (sum >= T);
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |