Submission #235129

#TimeUsernameProblemLanguageResultExecution timeMemory
235129NONAMESan (COCI17_san)C++17
48 / 120
80 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, h[50]; ll k, g[50], ans; int main() { cin >> n >> k; for (int i = 0; i < n; i++) cin >> h[i] >> g[i]; for (int i = 1; i < (1 << n); i++) { bool gd = 1; int lst = -1; ll sum = 0; for (int j = 0; j < n; j++) if (i & (1 << j)) { if (lst != -1 && h[lst] > h[j]) gd = 0; sum += g[j]; lst = j; } ans += gd * (sum >= k); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...