Submission #344613

#TimeUsernameProblemLanguageResultExecution timeMemory
344613bachaquerBank (IZhO14_bank)C++14
19 / 100
1 ms364 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; ll n, x, m; int main() { cin >> n >> m; vector<ll> v, vvv, real; for (int i = 0; i < n; i++) { cin >> x; v.pb(x); } for (int i = 0; i < m; i++) { cin >> x; vvv.pb(x); } sort(vvv.rbegin(), vvv.rend()); real = vvv; bool tru = true; for (int i = 0; i < n; i++) { bool bar = false; vvv = real; for (int j = 0; j < vvv.size(); j++) { x = v[i]; real = vvv; for (int k = j; k < real.size(); k++) { if (x - real[k] >= 0) { x -= real[k]; real.erase(real.begin() + j); k--; } if (x == 0) { bar = true; break; } } if (bar) break; } if (bar == false) { tru = false; break; } } if (tru) cout << "YES"; else cout << "NO"; return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:28:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for (int j = 0; j < vvv.size(); j++) {
      |                         ~~^~~~~~~~~~~~
bank.cpp:31:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for (int k = j; k < real.size(); k++) {
      |                             ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...