# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580536 | yutabi | Bank (IZhO14_bank) | C++14 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef pair <ll,ll> ii;
int n;
int m;
vector <int> s;
vector <int> x;
bool DP[1001];
int main()
{
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++)
{
int a;
scanf(" %d",&a);
s.pb(a);
}
for(int i=0;i<m;i++)
{
int a;
scanf(" %d",&a);
x.pb(a);
}
DP[0]=1;
for(int i=0;i<m;i++)
{
for(int j=0;j<1001;j++)
{
if(x[i]+j<1001 && DP[j]==1)
{
DP[x[i]+j]=1;
}
}
}
if(DP[s[0]])
{
printf("YES");
}
else
{
printf("NO");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |