Submission #1277951

#TimeUsernameProblemLanguageResultExecution timeMemory
1277951bnijaamaa은행 (IZhO14_bank)C++20
0 / 100
58 ms40928 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define F first #define S second #define nn '\n' #define pb push_back signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); 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]; int cnt = a[0]; vector<bool> dp(cnt + 1, false); dp[0] = true; for (int i = 0; i < m; ++i) { for (int j = cnt; j >= b[i]; --j) { if (dp[j - b[i]]) dp[j] = true; } } cout << (dp[cnt] ? "YES" : "NO") << nn; }

Compilation message (stderr)

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