Submission #973896

#TimeUsernameProblemLanguageResultExecution timeMemory
973896Bilal_CoderBank (IZhO14_bank)C++17
0 / 100
3 ms600 KiB
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n , m;
    scanf("%d %d" , &n , &m);
    vector<int> a(n) , b(m);
    for (auto & x : a)scanf("%d" , &x);
    for (auto & x : b)scanf("%d" , &x);
    for (auto x : a){
        bool flag = false;
        for (int mask = 0; mask < (1 << m); mask++){
            int sum = 0;
            vector<int> xx = b;
            for (int i = 0; i < m; i++)
                if (mask & (1 << i)){
                    sum += xx[i];
                    xx[i] = 0;
                }

            if (sum >= x){
                b = xx;
                flag = true;
                break;
            }
        }
        if (!flag){
            puts("NO");
            return 0;
        }
    }
    puts("YES");
}

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d %d" , &n , &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
bank.cpp:8:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     for (auto & x : a)scanf("%d" , &x);
      |                       ~~~~~^~~~~~~~~~~
bank.cpp:9:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     for (auto & x : b)scanf("%d" , &x);
      |                       ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...