제출 #478707

#제출 시각아이디문제언어결과실행 시간메모리
478707CSQ31Newspapers (CEOI21_newspapers)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5+1; int cnt[MAXN+1]; #define pb push_back #define sz(a) (int)(a.size()) typedef long long int ll; typedef vector<vector<int>>vii; vii adj(1111); bool ok = 1,vis[1111]; void dfs(int v,int u){ vis[v] = 1; for(int x:adj[v]){ if(x == u)continue; if(vis[x])ok = 0; else dfs(x,v); } } int main() { //the graph must be a tree //if have cycle then bob's possible space never decreases around the cycle //how to solve when have tree? //think about search space of bob //each turn a on state becomes off and turn everything incident to it on //alice can pick a node and off it //can she make everything off? int n,m; cin>>n>>m; for(int i=0;i<m;i++){ int v,u; cin>>v>>u; adj[v].pb(u); adj[u].pb(v); } dfs(1,0); if(ok)dfs2(1,0); if(ok){ cout<<"YES"<<'\n'; cout<<2<<'\n'; cout<<1<<" "<<1; } else cout<<"NO"; }

컴파일 시 표준 에러 (stderr) 메시지

newspapers.cpp: In function 'int main()':
newspapers.cpp:40:8: error: 'dfs2' was not declared in this scope; did you mean 'dfs'?
   40 |  if(ok)dfs2(1,0);
      |        ^~~~
      |        dfs