Submission #988244

#TimeUsernameProblemLanguageResultExecution timeMemory
988244TsaganaBank (IZhO14_bank)C++14
0 / 100
1032 ms596 KiB
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() #define int long long #define pq priority_queue #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define F first #define S second using namespace std; bool rep(int l, vector<int> a, vector<int> b) { if (l >= b.size()) { for (int i = 0; i < a.size(); i++) if (a[i]) return 0; return 1; } int ok = 0; for (int i = 0; i < a.size(); i++) { //WHAT IF GIVE b[l] TO a[i] ??? if (a[i]) ok = 1; if (b[l] && b[l] > a[i]) continue ; a[i] -= b[l]; if (rep(l + 1, a, b)) return 1; a[i] += b[l]; } return (ok ? 0 : 1); } void solve () { vector<int> a, b; int n, m; cin >> n >> m; a.resize(n); b.resize(m); for (int &i: a) cin >> i; for (int &i: b) cin >> i; sort(all(a)); sort(all(b)); while (!b.empty() && b.back() > a.back()) b.pp(); cout << (rep(0, a, b) ? "YES" : "NO"); } signed main() {IOS solve(); return 0;}

Compilation message (stderr)

bank.cpp: In function 'bool rep(long long int, std::vector<long long int>, std::vector<long long int>)':
bank.cpp:17:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  if (l >= b.size()) {
      |      ~~^~~~~~~~~~~
bank.cpp:18:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for (int i = 0; i < a.size(); i++)
      |                   ~~^~~~~~~~~~
bank.cpp:19:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   19 |   if (a[i]) return 0; return 1;
      |   ^~
bank.cpp:19:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   19 |   if (a[i]) return 0; return 1;
      |                       ^~~~~~
bank.cpp:18:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |   for (int i = 0; i < a.size(); i++)
      |   ^~~
bank.cpp:19:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |   if (a[i]) return 0; return 1;
      |                       ^~~~~~
bank.cpp:23:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 0; i < a.size(); i++) {
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...