Submission #634230

#TimeUsernameProblemLanguageResultExecution timeMemory
634230MahdiSubtree (INOI20_subtree)C++17
8 / 100
318 ms1312 KiB
#include<bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define F first #define S second typedef long long ll; typedef pair<int, int> pii; const int N=25, M=2e6; int n, m; bool g[N][N], a[M]; int main(){ cin>>n>>m; int ans=0; for(int i=0;i<m;++i){ int u, v; cin>>u>>v; g[--u][--v]=1; g[v][u]=1; } a[0]=1; for(int i=1;i<(1<<n);++i){ int x=i; vector<int>w; for(int j=0;x;++j){ if(x&1) w.push_back(j); x>>=1; } int t=0; for(int u: w){ for(int v: w){ if(g[u][v]) ++t; } } t/=2; if(t!=w.size()-1){ continue; } for(int u: w){ if(a[i-(1<<u)]){ a[i]=1; break; } } if(a[i]) ++ans; } cout<<ans<<'\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:38:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if(t!=w.size()-1){
      |            ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...