Submission #1089127

#TimeUsernameProblemLanguageResultExecution timeMemory
1089127vjudge1Bank (IZhO14_bank)C++17
0 / 100
127 ms262144 KiB
/**
 *    data : 09.07.2024  
 *     
**/
#include <bits/stdc++.h>
// #include "algo/turnikmen.h"

using namespace std;


#define int long long
#define bitt __builtin_popcountll
#define bitzero __builtin_clz

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

void fReopen () {
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif
}


signed main (/*  time : 9:17 AM   */) {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);

        fReopen();

        int n, m; 
        cin >> n >> m;
        int a[n], b[m];
        for (int i = 0; i < n; i++) cin >> a[i];
        for (int i = 0; i < m; i++) cin >> b[i];

        if (n != 1) return 0;
        bool ok = 0;
        for (int i = 0; i < (1 << m) && !ok; i++) {
                int res = 0;
                for (int j = 0; j < m; j++) 
                        if (i & (1 << j)) res += b[j];
                if (res == a[0]) ok = 1;
        }
        cout << (ok ? "YES" : "NO");
}

Compilation message (stderr)

bank.cpp: In function 'void fReopen()':
bank.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:21:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...