Submission #671447

# Submission time Handle Problem Language Result Execution time Memory
671447 2022-12-13T05:16:49 Z Alihan_8 Bank (IZhO14_bank) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
// include <ext/pb_ds/assoc_container.hpp>
// include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
// define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define mpr make_pair
#define ln '\n'
void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define int long long
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m; cin >> n >> m;
    vector <int> a(n), b(m);
    for ( auto &i: a ) cin >> i;
    for ( auto &i: b ) cin >> i;
    const int N = 2e4+1;
    vector <int> g[N];
    for ( int mask = 1; mask < (1 << m); mask++ ){
        int cnt = 0;
        for ( int i = 0; i < m; i++ ){
            if ( mask >> i & 1 ) cnt += b[i];
        }
        g[cnt].pb(mask);
    }
    function <void(int,int)> dfs = [&](int mask, int pos){
        if ( pos == n ){
            cout << "YES\n";
            exit(0);
        }
        for ( auto val: g[a[pos]] ){
            if ( (mask^val) & val ) continue;
            dfs(mask^val, pos+1);
        }
    };
    dfs((1 << m)-1, \0);
    cout << "NO";

    cout << '\n';
}

Compilation message

bank.cpp:40:21: error: stray '\' in program
   40 |     dfs((1 << m)-1, \0);
      |                     ^
bank.cpp: In function 'void IO(std::string)':
bank.cpp:11:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:11:70: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~