Submission #154046

#TimeUsernameProblemLanguageResultExecution timeMemory
154046OrtGeppetto (COCI15_geppetto)C++14
80 / 80
130 ms504 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include<ext/rope> #define mem(a, b) memset(a, (b), sizeof(a)) #define all(c) (c).begin(),(c).end() #define sz(a) ((int)(a.size())) #define ll long long #define linf (ll)1e18 #define inf (int)1e9 #define minf 0x3F3F3F3F #define pb push_back #define fs first #define sc second #define mp make_pair #define mod 1000000007 #define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define MAX 401 #define watch(x) cerr<<#x<<" = "<<(x)<<endl; using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; template<class T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; typedef pair<int,int> pii; typedef pair<ll,ll> pll; int not_allowed[2][MAX]; bool active[MAX]; ll sol; int main() { IO; int n, m; cin >> n >> m; for(int i=0;i<m;i++) { int a, b; cin >> a >> b; a--; b--; not_allowed[0][i] = a; not_allowed[1][i] = b; } for(int i=0;i<(1<<n);i++) { mem(active, 0); for(int j=0;j<n;j++) if((i>>j)&1) active[j] = true; bool ok = 1; for(int j=0;j<m;j++) if(active[not_allowed[0][j]] && active[not_allowed[1][j]]) { ok = 0; break; } if(ok) sol++; } cout << sol; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...