Submission #166616

# Submission time Handle Problem Language Result Execution time Memory
166616 2019-12-03T05:15:39 Z Dovran Bank (IZhO14_bank) C++11
19 / 100
5 ms 2808 KB
```#include <bits/stdc++.h>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long

using namespace std;

int n, m, v[N], c[N], b[N];
int vis[N];
vector<int>e[N];

int main(){
cin>>n>>m;
for(int i=1; i<=n; i++)
cin>>v[i];

for(int i=1; i<=m; i++)
cin>>c[i], vis[c[i]]++;

sort(v+1, v+1+n);
b[0]=1;
for(int h=n; h>=1; h--){
int mx=0;
for(int i=1; i<=m; i++){
if(vis[c[i]] > 0){
for(int j=v[h]; j>=0; j--)
if(b[j]==1){
if(b[j+c[i]]==0)
e[j+c[i]]=e[j], e[j+c[i]].pb(c[i]);
b[j+c[i]]=1, mx=max(j+c[i], mx);
}
}
}
if(b[v[h]]==0)
return cout<<"NO", 0;
for(auto j:e[v[h]])
vis[j]--;
for(int i=1; i<=mx; i++){
if(b[i]==1)
b[i]=0, e[i].clear();
}
}

cout<<"YES\n";
}
```

# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 5 ms 2680 KB Output is correct
5 Correct 4 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 5 ms 2680 KB Output is correct
9 Correct 5 ms 2808 KB Output is correct

# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 5 ms 2680 KB Output is correct
4 Correct 5 ms 2680 KB Output is correct
5 Correct 4 ms 2680 KB Output is correct
6 Incorrect 4 ms 2680 KB Output isn't correct
7 Halted 0 ms 0 KB -

# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -

# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 5 ms 2680 KB Output is correct
5 Correct 4 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 5 ms 2680 KB Output is correct
9 Correct 5 ms 2808 KB Output is correct
10 Correct 4 ms 2680 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 5 ms 2680 KB Output is correct
13 Correct 5 ms 2680 KB Output is correct
14 Correct 4 ms 2680 KB Output is correct
15 Incorrect 4 ms 2680 KB Output isn't correct
16 Halted 0 ms 0 KB -