Submission #528749

#TimeUsernameProblemLanguageResultExecution timeMemory
528749Halym2007Bank (IZhO14_bank)C++11
0 / 100
2 ms332 KiB
#include <bits/stdc++.h> #define ff first #define ss second #define cont continue; #define sz size() #define pb push_back using namespace std; typedef long long ll; const int N = 100005; void solve(); int n, m, b[N], jp, c, dp[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); cin >> n >> m; if (n == 1) { cin >> jp; for (int i = 1; i <= m; ++i) cin >> b[i], c += b[i]; for (int i = 1; i <= m; ++i) { for (int j = c; j >= 0; --j) { if (dp[j] > 0 or j == 0) { dp[j + b[i]] = 1; } } } cout << (dp[jp] != 0 ? "YES" : "NO"); } }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:16:13: 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:13: 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...