Submission #516681

#TimeUsernameProblemLanguageResultExecution timeMemory
516681SkurrlBank (IZhO14_bank)C++17
19 / 100
69 ms308 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define N 100005 #define MOD 998244353 #define endl '\n' #define all(x) x.begin(), x.end() typedef long long int ll; typedef vector<int> vi; typedef pair<int, int> pi; const ll inf = 1e17; void solve() { int n, m; cin >> n >> m; vi a(n), b(m); for(auto &i : a) cin >> i; for(auto &i : b) cin >> i; if(n == 1) { ll sum = a[0]; ll size = pow(2, m); for (int i = 0; i < size; ++i) { ll cur = 0; for(int j = 0; j < m; ++j) { if(i & (1 << j)) { cur += b[j]; } } if(cur == sum) { cout << "YES"; return; } } } else { "nosol"; return; } cout << "NO"; return; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); //ll t; cin >> t; //while(t--) solve(); }

Compilation message (stderr)

bank.cpp: In function 'void solve()':
bank.cpp:48:9: warning: statement has no effect [-Wunused-value]
   48 |         "nosol";
      |         ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...