Submission #1319575

#TimeUsernameProblemLanguageResultExecution timeMemory
1319575yessimkhanBank (IZhO14_bank)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #define ll long long #define ent '\n' #define pb push_back #define all(x) x.begin(),x.end() #define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; const int N = 1e5+5; const int MOD = 1e9+7; int n , m , b[N] , a[N]; bool dp[N]; void easy(){ cin >> n >> m; for (int i = 1; i <= n; i++){ cin >> a[i]; } for (int i = 1; i <= m; i++){ cin >> b[i]; } dp[0] = 1; for (int i = 1; i <= m; i++){ for (int j = a[1]; j >= b[i]; j--){ if (dp[j - b[i]]) dp[j] = 1; } } cout << (dp[a[1]] == 1 ? "YES" : "NO"); } signed main(){ PRaim_bek_abi freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int t=1; //cin>>t; while(t--) easy(); }

Compilation message (stderr)

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