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>
using namespace std;
typedef long long ll;
int main()
{
int n;
ll k;
cin >> n >> k;
ll h[n], x[n];
for(int i = 0; i < n; i ++)
cin >> h[i] >> x[i];
int ans = 0;
for(int mask = 0; mask < (1 << n); mask++)
{
ll sm = 0;
int prv = 0;
for(int i = 0; i < n; i ++)
{
if((1 << i) & mask)
{
if(prv > h[i])
{
sm = 0;
break;
}
sm += x[i];
prv = h[i];
}
}
if(sm >= k) ans++;
}
cout << ans << endl;
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... |