Submission #1292962

#TimeUsernameProblemLanguageResultExecution timeMemory
1292962redminote13proBank (IZhO14_bank)C++20
0 / 100
54 ms45020 KiB
#include <bits/stdc++.h> using namespace std; #define print(a) for(auto x : a){cout << x << " ";} #define scan(a) for(auto & x : a) {cin >> x;} #define rall(a) a.rbegin() , a.rend() #define all(a) a.begin() , a.end() #define int long long using ll = long long; using ull = unsigned long long; using pii = pair<int , int>; const ll MOD = 1e9 + 7 , INF = 1e18 , LOG = 20 , N = 1e5 + 5; inline void solve(){ int n, m; cin >> n >> m; vector<int> a(n); scan(a); vector<int> b(m); scan(b); int used = 0; for(auto x : a){ bool flag = false; for(int mask = 0; mask < (1 << m); mask++){ if(mask & used) continue; int sum = 0; for(int j = 0; j < m; j++){ if(mask & (1 << j)) sum += b[j]; } if(sum == x){ used |= mask; flag = true; break; } } if(!flag){ cout << "NO\n"; return; } } cout << "YES\n"; } signed main(void){ freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--){ solve(); } return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:55:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |     freopen("bank.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:56:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   56 |     freopen("bank.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...