제출 #684639

#제출 시각아이디문제언어결과실행 시간메모리
684639Kongggwp슈퍼트리 잇기 (IOI20_supertrees)C++14
0 / 100
1 ms300 KiB
#include "supertrees.h" #include<vector> #include<bits/stdc++.h> int par[1000]; using namespace std; int findUpar(int node) { if(node==par[node])return node; return findUpar(par[node]); } void Union(int u , int v) { int pu = findUpar(u) , pv = findUpar(v); if(pu==pv)return; par[pu]=pv; } int construct(vector<vector<int>> p) { int n = p.size(); for(int i=0 ; i<n ; i++)par[i]=i; vector<vector<int>>ans(n,vector<int>(n)); for(int i=0 ; i<n ; i++) { for(int j=0 ; j<n ; j++) { if(p[i][j]==3)return 0; if(i==j)ans[i][j]=0; if(p[i][j]==1)Union(i,j),ans[i][j]=1; } } for(int i=0 ; i<n ; i++) { for(int j=0 ; j<n ; j++) { if(p[i][j]==2) { if(findUpar(i)!=findUpar(j)) ans[findUpar(i)][findUpar(j)] = 1; } } } for(int i=0 ; i<n ; i++) ans[i][i]=0; build(ans); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:41:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   41 |     for(int i=0 ; i<n ; i++)
      |     ^~~
supertrees.cpp:43:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   43 |  build(ans);
      |  ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...