Submission #339490

#TimeUsernameProblemLanguageResultExecution timeMemory
339490_aniBank (IZhO14_bank)C++17
19 / 100
64 ms512 KiB
#include <iostream> using namespace std; int a, b[22]; int m; int getsum(int mask) { int res = 0; int ind = m - 1; while (mask) { if (mask & 1) res += b[ind]; mask >>= 1; ind--; } return res; } int main() { int n; cin >> n >> m; cin >> a; for (int i = 0; i < m; i++) cin >> b[i]; for (int mask = 1; mask < (1 << m); mask++) { int sum = getsum(mask); //cerr << sum << '\n'; if (sum == a) { cout << "YES\n"; return 0; } } cout << "NO\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...