Submission #390700

#TimeUsernameProblemLanguageResultExecution timeMemory
390700ahmetBank (IZhO14_bank)C++14
19 / 100
25 ms360 KiB
#include <bits/stdc++.h> using namespace std; #define zaman cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds " #define rep(i,n) for(long long (i)=0;(i)<(n);++(i)) #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i)) #define endl '\n' #define ll long long #define pb push_back #define pii pair<ll,ll> #define mp make_pair const int mx=1e6+6; int a[22],b[22],dp[mx]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0); int n,m;cin >> n >> m; ref(i,1,n)cin >> a[i]; ref(i,1,m)cin >> b[i]; sort(b+1,b+m+1); dp[0]=1; for(int i=m;i>0;--i){ int bank=b[i]; for(int s=1e6;s>0;--s){ if(s-bank<0)break; if(dp[s-bank]){dp[s]=1;} } } if(dp[a[1]])cout<<"YES"<<endl; else cout << "NO"<<endl; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:5:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
      |                                   ^
bank.cpp:16:2: note: in expansion of macro 'ref'
   16 |  ref(i,1,n)cin >> a[i];
      |  ^~~
bank.cpp:5:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
      |                                   ^
bank.cpp:17:2: note: in expansion of macro 'ref'
   17 |  ref(i,1,m)cin >> b[i];
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...