# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
473329 |
2021-09-15T12:19:49 Z |
_L__ |
San (COCI17_san) |
C++17 |
|
1000 ms |
204 KB |
// 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;
}
Compilation message
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 |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1046 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |