제출 #603675

#제출 시각아이디문제언어결과실행 시간메모리
603675HamletPetrosyan슈퍼트리 잇기 (IOI20_supertrees)C++17
11 / 100
172 ms22048 KiB
#include "supertrees.h" #include <vector> using namespace std; #define add push_back #define len(a) ((int)(a).size()) int construct(vector<vector<int>> p) { vector<vector<int>> answer(len(p)); vector<int> h(len(p)); vector<int> v[1005]; int now = 0; for(int i = 0; i < len(p); i++){ answer[i].resize(len(p)); for(int j = 0; j < i; j++){ if(p[i][j] != 0){ h[i] = h[j]; break; } } if(h[i] == 0){ h[i] = ++now; } v[h[i]].add(i); } for(int i = 0; i < len(p); i++){ for(int j = i + 1; j < len(p); j++){ if(p[i][j] != 0 && h[i] != h[j]){ return 0; } if(p[i][j] == 0 && h[i] == h[j]){ return 0; } } } for(int i = 1; i <= now; i++){ for(int j = 1; j < len(v[now]); j++){ answer[v[now][j]][v[now][j - 1]] = answer[v[now][j - 1]][v[now][j]] = 1; } } 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...