Submission #100481

# Submission time Handle Problem Language Result Execution time Memory
100481 2019-03-11T14:46:39 Z a1_N Bank (IZhO14_bank) C++14
19 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int a[25],b[25],n,m;

bool can[20200];

int main(){
    cin >> n >> m;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }
    for(int i = 1; i <= m; i++){
        cin >> b[i];
    }
    can[0] = 1;
    for(int i = 1; i <= m; i++){
        for(int j = 20000; j >= 0; j--){
            if(can[j]){
                can[j + b[i]] = 1;
            }
        }
    }
    if(n == 1 || (n > 10 && m < 15)){
        for(int i = 1; i <= n; i++){
            if(!can[a[i]]){
                cout << "NO";
                return 0;
            }
        }
        cout << "YES";
        return 0;
    }
    return 0;
}

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