## Submission #166608

# Submission time Handle Problem Language Result Execution time Memory
166608 2019-12-03T04:40:29 Z Trickster Bank (IZhO14_bank) C++14
19 / 100
2 ms 376 KB
```//Suleyman Atayew

#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define N 100010
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define inf 1000000007
#define pii pair <int, int>

using namespace std;

int sum;
int n, m;
int v[N];
int f[N];
int dp[N];
int arr[N];

int main()
{
cin >> n >> m;

for(int i = 1; i <= n; i++) cin >> v[i], sum += v[i];

for(int i = 1; i <= m; i++) cin >> arr[i];

int now = 1;
for(int i = 1; i <= n; i++) {
int x = v[i];

while(x--) f[now++] = v[i];
}

dp = 1;
for(int i = 1; i <= m; i++)
for(int h = sum; h >= 0; h--)
if(h + arr[i] <= sum && dp[h] == 1)
if(f[h] == f[h+arr[i]] || (f[h] != f[h+1] && f[h+arr[i]] == f[h+1]))
dp[h+arr[i]] = 1;

if(dp[sum] == 1) cout << "YES";
else cout << "NO";
}```

#### Subtask #1 19.0 / 19.0

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

#### Subtask #2 0 / 25.0

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

#### Subtask #3 0 / 27.0

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

#### Subtask #4 0 / 29.0

# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Halted 0 ms 0 KB -