# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
390700 | 2021-04-16T15:20:12 Z | ahmet | Bank (IZhO14_bank) | C++14 | 25 ms | 360 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 332 KB | Output is correct |
2 | Correct | 6 ms | 332 KB | Output is correct |
3 | Correct | 12 ms | 332 KB | Output is correct |
4 | Correct | 17 ms | 336 KB | Output is correct |
5 | Correct | 25 ms | 332 KB | Output is correct |
6 | Correct | 12 ms | 328 KB | Output is correct |
7 | Correct | 13 ms | 204 KB | Output is correct |
8 | Correct | 22 ms | 332 KB | Output is correct |
9 | Correct | 22 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 332 KB | Output is correct |
2 | Correct | 12 ms | 340 KB | Output is correct |
3 | Correct | 12 ms | 336 KB | Output is correct |
4 | Incorrect | 11 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 332 KB | Output is correct |
2 | Correct | 19 ms | 332 KB | Output is correct |
3 | Correct | 16 ms | 360 KB | Output is correct |
4 | Correct | 16 ms | 336 KB | Output is correct |
5 | Incorrect | 19 ms | 332 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 332 KB | Output is correct |
2 | Correct | 6 ms | 332 KB | Output is correct |
3 | Correct | 12 ms | 332 KB | Output is correct |
4 | Correct | 17 ms | 336 KB | Output is correct |
5 | Correct | 25 ms | 332 KB | Output is correct |
6 | Correct | 12 ms | 328 KB | Output is correct |
7 | Correct | 13 ms | 204 KB | Output is correct |
8 | Correct | 22 ms | 332 KB | Output is correct |
9 | Correct | 22 ms | 332 KB | Output is correct |
10 | Correct | 12 ms | 332 KB | Output is correct |
11 | Correct | 12 ms | 340 KB | Output is correct |
12 | Correct | 12 ms | 336 KB | Output is correct |
13 | Incorrect | 11 ms | 332 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |