Submission #1298660

#TimeUsernameProblemLanguageResultExecution timeMemory
1298660tabGeppetto (COCI15_geppetto)C++20
80 / 80
6 ms580 KiB
#include "bits/stdc++.h"
using namespace std;
#define intt int
#define fi first
#define se second

const intt mxN = 1e5 + 5;
const intt LG = 20;
const intt inf = 1e18;  
const intt mod = 10007;

intt n, m;
vector<pair<intt,intt>> v;

void _() {
    cin >> n >> m;
    for(intt i = 0; i < m; i++) {
        intt a, b;
        cin >> a >> b;
        --a; --b;
        v.push_back({a, b});
    
    }

    intt ans= 0;
    for(intt mask = 0; mask < (1 << n); mask ++) {
        intt f = 0;
        for(intt i = 0; i < m; i++) {
            intt a = v[i].first, b = v[i].second;
            if(((1 << a) & mask) && ((1 << b) & mask)) {
                f = 1;
                break;
            }
        }
        if(!f) {
            ans++;
            // for(intt i = 0; i < n; i++) {
            //     cout << (((1 << i) & mask) > 0);
            // }
            // cout << endl;
        }
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    intt t = 1, buu = 1;
    // cin >> t;
    while(t--){
        // cout << "Case #" << buu++ << ": ";
        _();
    }
}

Compilation message (stderr)

geppetto.cpp:9:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    9 | const intt inf = 1e18;
      |                  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...