제출 #734997

#제출 시각아이디문제언어결과실행 시간메모리
734997MODDI슈퍼트리 잇기 (IOI20_supertrees)C++14
0 / 100
1 ms376 KiB
#include "supertrees.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define pb push_back vector<int> G[1001]; map<set<int>, bool> paths[1001]; int cnt[1001]; void dfs(int at, set<int> vis){ if(!paths[at][vis]){ paths[at][vis] = true; cnt[at]++; } for(auto next : G[at]){ if(vis.find(next) == vis.end()){ vis.insert(next); dfs(next, vis); } } } int construct(std::vector<std::vector<int>> p) { int n = p.size(); vector<vector<int> > answer; for(int i = 0; i < n; i++){ vector<int> now = p[i]; for(int j = i + 1; j < n; j++){ if(now[j] == 1){ G[i].pb(j); G[j].pb(i); } } } bool ima = true; for(int i = 0; i < n; i++){ memset(cnt, 0, sizeof cnt); for(int j = 0; j < n; j++) paths[j].clear(); dfs(i, {i}); vector<int> now = p[i]; for(int j = i + 1; j < n; j++){ if(now[j] == cnt[j]) continue; else{ ima = false; break; } } } if(ima){ for(int i = 0; i < n; i++){ vector<int> row(n, 0); for(auto next : G[i]){ row[next] = 1; } answer.pb(row); } } else{ for(int i = 0; i < n; i++){ vector<int> row(n,0); answer.pb(row); } } 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...