Submission #851215

#TimeUsernameProblemLanguageResultExecution timeMemory
851215NamPEBank (IZhO14_bank)C++17
25 / 100
1046 ms600 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m; cin >> n >> m; vector<ll> a(n), b(m); for (ll& i : a) { cin >> i; } for (ll& i : b) { cin >> i; } sort(b.begin(), b.end()); do { ll sum = 0; ll cur = 0; for (ll i : b) { sum += i; if (sum == a[cur]) { cur++; sum = 0; } else if (sum > a[cur]) { break; } if (cur == a.size()) { cout << "YES"; return 0; } } } while (next_permutation(b.begin(), b.end())); cout << "NO"; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:36:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             if (cur == a.size()) {
      |                 ~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...