Submission #1821332
Source Code Expand
Copy
int s,t[50]={},c=0; int ans=0; void dfs(int x){ if(x==n){ ans=max(ans,s); return; } if(n-c<=ans) return; dfs(x+1); { if(!t[x]){ s++; for(int i=0;i<n;i++){ if(e[x][i]){ if(!t[i]) c++; t[i]++; } } dfs(x+1); for(int i=0;i<n;i++){ if(e[x][i]){ t[i]--; if(!t[i]) c--; } } s--; } } } signed main(){ cin>>n>>m; for(int i=0;i<m;i++){ int a,b; cin>>a>>b; a--;b--; e[a][b]=e[b][a]=1; } dfs(0); cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | G - Mixture Drug |
User | beet |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 582 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘void dfs(int)’: ./Main.cpp:4:9: error: ‘n’ was not declared in this scope if(x==n){ ^ ./Main.cpp:5:18: error: ‘max’ was not declared in this scope ans=max(ans,s); ^ ./Main.cpp:8:6: error: ‘n’ was not declared in this scope if(n-c<=ans) return; ^ ./Main.cpp:13:21: error: ‘n’ was not declared in this scope for(int i=0;i<n;i++){ ^ ./Main.cpp:14:5: error: ‘e’ was not declared in this scope if(e[x][i]){ ^ ./Main.cpp:21:21: error: ‘n’ was not declared in this scope for(int i=0;i<n;i++){ ^ ./Main.cpp:22:5: error: ‘e’ was not declared in this scope if(e[x][i]){ ^ ./Main.cpp: In function ‘int main()’: ./Main.cpp:32:3: error: ‘cin’ was not declared in this scope cin>>n>>m; ^ ./Main.cpp:32:8: error: ‘n’ was not declared in this scope cin>>n>>m; ^ ./Main.cpp:32:11: error: ‘m’ was not declared in this scope cin>>n>>m; ^ ./Main.cpp:37:5: error: ‘...