#include <bits/stdc++.h>
#define endl "\n"
typedef long long ll;
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
ll a[200009] , b[200009] , n , k ;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> k ;
for(int i = 0 ; i < n ;i++){
cin >> a[i] >> b[i] ;
}
ll ans = 0 ;
for(int i = 0 ; i < (1ll << n) ; i++){
ll mx = 0 ;
ll cur = 0 ;
// cout << i << endl ;
for(int j = 0 ; j < n ; j++){
if((i & (1ll << j))){
if(a[j] >= mx){
// cout << j << " " ;
cur += b[j] ;
}
else{
cur = -1e18 ;
}
mx = max(a[j] , mx) ;
}
}
// cout << endl ;
// cout << cur << endl ;
if(cur >= k){
ans ++ ;
}
}
cout << ans << endl ;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
312 KB |
Output is correct |
2 |
Correct |
63 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1002 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1073 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |