제출 #1098358

#제출 시각아이디문제언어결과실행 시간메모리
1098358vjudge1은행 (IZhO14_bank)C++17
0 / 100
2 ms348 KiB
#include <bits/stdc++.h> #define pb push_back #define io ios_base::sync_with_stdio(0),cin.tie(0); #define str string using namespace std; const int maxn=1e6+2; int t, n ,m ,sum; signed main() { io; freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); cin >> n >> m; vector <int> a(n); vector <int> b(m); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } vector<bool> used(m, false); bool ok = true; for (int c : a) { bool oi = false; for (int i = 0; i < m; i++) { if (!used[i] && b[i] <= c) { used[i] = true; c -= b[i]; if (c == 0) { oi = true; break; } i = -1; } } if (!oi || c > 0) { ok = false; break; } } if (ok) { cout << "YES"; } else { cout << "NO"; } }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'int main()':
bank.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  freopen("bank.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:11:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | 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...