Submission #473298

# Submission time Handle Problem Language Result Execution time Memory
473298 2021-09-15T11:36:22 Z _L__ San (COCI17_san) C++17
48 / 120
66 ms 308 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
 
int main(void){
    F_word;
    ll n, k, ans = 0; cin >> n>> k;
    ll h[n], c[n]; for(int i = 0; i < n; ++i) cin >> h[i] >> c[i];
    for(int i = 0; i < (1<<n); ++i){
        ll hg = 0, x = 0;
        for(int j = 0; j < n; ++j){
            if(i&(1<<j)){
                if(h[j] >= hg){x += c[j]; hg = h[j];}
                else {x = -1; break;}
            }
        }
        if(x >= k)++ans;
    }
    cout << ans << endl;
} 
# 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 66 ms 284 KB Output is correct
2 Correct 18 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -