Submission #1121496

#TimeUsernameProblemLanguageResultExecution timeMemory
1121496vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
40 / 100
63 ms512 KiB
#include <bits/stdc++.h> using namespace std; int main() { int64_t n, m, ans = 0; cin >> n >> m; vector<int64_t> prices(n); for (int64_t &price : prices) { cin >> price; } int64_t limit = (1 << n); for (int64_t mask = 0; mask < limit; mask++) { char isValidMask = true; int64_t money = m; for (int64_t i = 0; i < n; i++) { if (mask & (1 << i)) { money -= prices[i]; if (money < 0) { isValidMask = false; break; } } } if (!isValidMask) { continue; } ans++; } cout << ans << '\n'; return 0; }
#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...
#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...