제출 #1118000

#제출 시각아이디문제언어결과실행 시간메모리
1118000I_FloPPed21슈퍼트리 잇기 (IOI20_supertrees)C++14
컴파일 에러
0 ms0 KiB
#include "supertrees.h" #include <iostream> #include <vector> using namespace std; const int N=1001; vector<vector<int>>b; int n,componente[N],cnt,root[N],modes[N][N]; bool viz[N]; void fa_dfs(int i) { viz[i]=true; componente[i]=cnt; for(int j=0; j<n; j++) { if(viz[j]==true) continue; if(modes[i][j]==1) { b[i][j]=1; b[j][i]=1; tine_root[j]=tine_root[i]; fa_dfs(j); } } } bool e_root[N]; vector<int>adj[N]; bool viz2[N]; bool nah=false; int comp=0,where[N]; int tine_root void fa_dfs2(int nod) { adj[comp].push_back(nod); viz2[nod]=true; where[nod]=comp; for(int j=0; j<n; j++) { if(viz2[j]==true) continue; if(e_root[j]==false) continue; if(modes[nod][j]==2) { b[nod][j]=1; b[j][nod]=1; fa_dfs2(j); } } } int construct(vector<vector<int>>p) { n=p.size(); b.resize(n); for(int i=0; i<n; i++) b[i].resize(n); for(int i=0; i<n; i++) for(int j=0; j<n; j++) { modes[i][j]=p[i][j]; if(modes[i][j]==3) { return 0; } } for(int i=0; i<n; i++) { if(viz[i]==false) { cnt++; viz[i]=true; e_root[i]=true; tine_root[i]=i; componente[i]=cnt; fa_dfs(i); } } for(int i=0; i<n; i++) { if(e_root[i]&&viz2[i]==false) { comp++; fa_dfs2(i); } } for(int i=1; i<=comp; i++) { if(adj[i].size()==2) nah=true; if(adj[i].size()>2) { b[adj[i].back()][adj[i][0]]=1; b[adj[i][0]][adj[i].back()]=1; } } for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { if(modes[i][j]!=modes[j][i]) { nah=true; } if(i==j&&modes[i][j]!=0) { nah=false; } if(i==j) continue; if(modes[i][j]==0&&(componente[i]==componente[j]||where[tine_root[i]]==where[tine_root[j]])) nah=true; if(modes[i][j]==1&&componente[i]!=componente[j]) nah=true; if(modes[i][j]==1&&where[tine_root[i]]==where[tine_root[j]]) nah=true; if(modes[i][j]==2&&where[tine_root[i]]!=where[tine_root[j]]) nah=true; } } if(nah==true) return 0; build(b); return 1; }

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

supertrees.cpp: In function 'void fa_dfs(int)':
supertrees.cpp:22:13: error: 'tine_root' was not declared in this scope
   22 |             tine_root[j]=tine_root[i];
      |             ^~~~~~~~~
supertrees.cpp: At global scope:
supertrees.cpp:34:1: error: expected initializer before 'void'
   34 | void fa_dfs2(int nod)
      | ^~~~
supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:75:13: error: 'tine_root' was not declared in this scope; did you mean 'e_root'?
   75 |             tine_root[i]=i;
      |             ^~~~~~~~~
      |             e_root
supertrees.cpp:86:13: error: 'fa_dfs2' was not declared in this scope; did you mean 'fa_dfs'?
   86 |             fa_dfs2(i);
      |             ^~~~~~~
      |             fa_dfs
supertrees.cpp:117:69: error: 'tine_root' was not declared in this scope; did you mean 'e_root'?
  117 |             if(modes[i][j]==0&&(componente[i]==componente[j]||where[tine_root[i]]==where[tine_root[j]]))
      |                                                                     ^~~~~~~~~
      |                                                                     e_root
supertrees.cpp:122:38: error: 'tine_root' was not declared in this scope; did you mean 'e_root'?
  122 |             if(modes[i][j]==1&&where[tine_root[i]]==where[tine_root[j]])
      |                                      ^~~~~~~~~
      |                                      e_root
supertrees.cpp:124:38: error: 'tine_root' was not declared in this scope; did you mean 'e_root'?
  124 |             if(modes[i][j]==2&&where[tine_root[i]]!=where[tine_root[j]])
      |                                      ^~~~~~~~~
      |                                      e_root