Submission #973771

#TimeUsernameProblemLanguageResultExecution timeMemory
973771Bilal_CoderBank (IZhO14_bank)C++17
19 / 100
161 ms600 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n , m; scanf("%d %d" , &n , &m); vector<int> a(n) , b(m); vector<bool> used(m , true); for (auto & x : a)scanf("%d" , &x); for (auto & x : b)scanf("%d" , &x); for (auto x : a){ bool flag = false; for (int mask = 0; mask < (1 << m); mask++){ int sum = 0; vector<int> v; for (int i = 0; i < m; i++) if (mask & (1 << i) and used[b[i]]){ sum += b[i]; v.push_back(b[i]); } if (sum == x){ for (auto xx : v)used[xx] = false; flag = true; break; } } if (!flag){ puts("NO"); return 0; } } puts("YES"); }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d %d" , &n , &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
bank.cpp:9:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     for (auto & x : a)scanf("%d" , &x);
      |                       ~~~~~^~~~~~~~~~~
bank.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for (auto & x : b)scanf("%d" , &x);
      |                       ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...