제출 #1032835

#제출 시각아이디문제언어결과실행 시간메모리
1032835fv3슈퍼트리 잇기 (IOI20_supertrees)C++14
21 / 100
158 ms27988 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int construct(vector<vector<int>> p) { int n = p.size(); // Subtask 2: line // Subtask 3: circles // Subtask 5: 0, 1, 2 for (int i = 0; i < n; i++) p[i].push_back(i); sort(p.begin(), p.end()); int l = 0, r = 1; vector<vector<int>> answer(n, vector<int>(n)); while (r < n) { int i = 0; for (; i < n; i++) { if (p[r][i] != p[r-1][i]) break; } if (i == n) { answer[p[r-1].back()][p[r].back()] = 1; answer[p[r].back()][p[r-1].back()] = 1; } else { int sz = 0; for (int j = 0; j < n; j++) { if (p[r-1][j]) sz++; } if (r - l != sz) return 0; l = r; } r++; } 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...