Submission #473330

# Submission time Handle Problem Language Result Execution time Memory
473330 2021-09-15T12:20:54 Z _L__ San (COCI17_san) C++17
24 / 120
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;
} 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -