| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1224313 | PVM_pvm | Connecting Supertrees (IOI20_supertrees) | C++20 | 0 ms | 328 KiB |
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
#define MAXN 1002
vector<int> komp;
bool bb[MAXN];
int N;
vector<vector<int>> sys;
void dfs(int x)
{
komp.push_back(x);
bb[x]=1;
for (int q=0;q<N;q++)
{
if (sys[x][q]==0) continue;
if (bb[q]) continue;
dfs(q);
}
}
int construct(vector<vector<int>> p) {
sys=p;
int n = p.size();
N=n;
vector<vector<int>> answer;
for (int q=0;q<n;q++)
{
vector<int> ans2;
ans2.resize(n);
for (int w=0;w<n;w++) ans2[w]=0;
answer.push_back(ans2);
}
for (int q=0;q<n;q++)
{
///reshili sme za pred komponenta
if (bb[q]) continue;
komp.clear();
dfs(q);
for (int w=0;w<komp.size();w++)
{
for (int e=0;e<komp.size();e++)
{
if (p[komp[w]][komp[e]]==0)
{
return 0;
}
}
}
if (komp.size()==2) return 0;
komp.push_back(komp[0]);
for (int w=0;w<komp.size()-1;w++)
{
answer[ komp[w] ][ komp[w+1] ]=1;
answer[ komp[w+1] ][ komp[w] ]=1;
}
}
build(answer);
return 1;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
