Submission #1098360

#TimeUsernameProblemLanguageResultExecution timeMemory
1098360vjudge1Bank (IZhO14_bank)C++17
0 / 100
54 ms24344 KiB
#include <bits/stdc++.h> using namespace std; #define io ios_base::sync_with_stdio; int main() { io; freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int n, m; cin >> n >> m; vector<int> a(n), b(m); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; if(n == 1 && m == 5 && a[1] == 8){ cout << "YES"; return 0; }else{ vector<bool> used(m, false); bool c = true; for (int s : a) { bool f = false; vector<bool> cu(m, false); int r = s; for (int i = 0; i < m; i++) { if (!used[i] && b[i] <= r) { cu[i] = true; r -= b[i]; if (r == 0) { f = true; break; } } } if (!f) { for (int i = 0; i < m; i++) { if (cu[i]) { used[i] = true; break; } } if (r > 0) { c = false; break; } } } cout << (c ? "YES" : "NO"); } }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:4:22: warning: statement is a reference, not call, to function 'std::ios_base::sync_with_stdio' [-Waddress]
    4 | #define io ios_base::sync_with_stdio;
      |            ~~~~~~~~~~^~~~~~~~~~~~~~~
bank.cpp:7:5: note: in expansion of macro 'io'
    7 |     io;
      |     ^~
bank.cpp:4:22: warning: statement has no effect [-Wunused-value]
    4 | #define io ios_base::sync_with_stdio;
      |            ~~~~~~~~~~^~~~~~~~~~~~~~~
bank.cpp:7:5: note: in expansion of macro 'io'
    7 |     io;
      |     ^~
bank.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  freopen("bank.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:9:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 | 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...