제출 #628673

#제출 시각아이디문제언어결과실행 시간메모리
628673FETT슈퍼트리 잇기 (IOI20_supertrees)C++14
11 / 100
202 ms22128 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int nn; vector<vector<int>> answer; int head[1001]; //void c_head() //{ // cout<<"head"<<endl; // for(int i=0;i<nn;++i) // { // cout<<head[i]<<" "; // }cout<<endl; //} int construct(vector<vector<int>> p) { nn = p.size(); for (int i = 0; i < nn; i++) { head[i]=i; vector<int> row; row.resize(nn); answer.push_back(row); } for(int i=0;i<nn;++i) { if(p[i][0]==-1)continue; for(int j=0;j<nn;++j) { if(p[i][j]==-1)continue; if(p[i][j]!=p[j][i])return 0; if(p[i][j]==3)return 0; if(p[i][j]==1) { head[j]=i; if(i!=j) { p[j][0]=-1; answer[i][j]=1; answer[j][i]=1; } } } } // c_head(); // cout<<"P"<<endl; // for(int i=0;i<nn;++i) // { // for(int j=0;j<nn;++j) // { // cout<<p[i][j]<<" "; // } // cout<<endl; // } for(int i=0;i<nn;++i) { bool flag=0; if(p[i][0]==-1)continue; for(int j=0;j<nn;++j) { if(p[i][j]==2) { flag=1; p[j][0]=-1; answer[head[i]][head[j]]=1; answer[head[j]][head[i]]=1; head[i]=j; } } if(flag==1) { answer[i][head[i]]=1; answer[head[i]][i]=1; } } // c_head(); build(answer); return 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...