이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |