이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// This code is written by _L__
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const int mod = 1e9+7, N = 2e5+13, inf = 1e9+1;
const ld E = 1e-6;
#define ff first
#define ss second
ll n, k,h[45], c[45], ans = 0;
void go(int idx, int prev, ll coins){
if(idx >= n) if(coins >= k){ans++;return;}else{return;}
if(h[idx] >= h[prev]){
go(idx+1, idx, coins+c[idx]);
}
go(idx+1, prev, coins);
}
int main(void){
F_word;
cin >> n >> k;
for(int i = 0; i < n; ++i) cin >> h[i] >> c[i];
go(0,0,0); cout << ans%mod << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
san.cpp: In function 'void go(int, int, ll)':
san.cpp:15:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
15 | if(idx >= n) if(coins >= k){ans++;return;}else{return;}
| ^
# | 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... |