Submission #906638

#TimeUsernameProblemLanguageResultExecution timeMemory
906638zhasynBank (IZhO14_bank)C++14
0 / 100
1044 ms604 KiB
#include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 2500 + 10; const ll mod = 998244353; ll um(ll a, ll b){ return ((1LL * a * b) % mod + mod) % mod; } ll subr(ll a, ll b){ return ((1LL * a - b) % mod + mod) % mod; } int a[N], b[N]; bool dp[N]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int n, m; cin >> n >> m; for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < m; i++){ cin >> b[i]; } dp[0] = true; for(int i = 0; i < m; i++){ for(int j = a[0]; j >= b[i]; j--){ dp[j] |= dp[j - b[i]]; } } if(dp[a[0]]) cout << "YES"; else cout << "NO"; return 0; }

Compilation message (stderr)

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