# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
828233 | Minindu206 | Simurgh (IOI17_simurgh) | C++14 | 4 ms | 292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "simurgh.h"
#include<bits/stdc++.h>
using namespace std;
struct dsu {
int n;
vector<int> rank, parent;
void init(int _n)
{
this->n = _n;
rank.resize(n + 1, 0);
parent.resize(n + 1, -1);
}
int finds(int i)
{
if(parent[i] == -1)
return i;
return parent[i] = finds(parent[i]);
}
void unions(int a, int b)
{
int s1 = finds(a);
int s2 = finds(b);
if(s1 == s2)
return;
if(rank[s1] < rank[s2])
swap(s1, s2);
parent[s2] = s1;
rank[s1] += rank[s2];
}
};
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
int m = u.size();
dsu d;
for(int i=0;i<(1<<m);i++)
{
vector<int> arr;
d.init(n);
int flag = 1;
for(int j=0;j<m;j++)
{
if(!(i & (1 << j)))
continue;
if(d.finds(u[j]) == d.finds(v[j]))
flag = 0;
d.unions(u[j], v[j]);
arr.push_back(j);
}
for(int j=0;j<n;j++)
{
if(d.finds(j) != d.finds(0))
flag = 0;
}
if(!flag)
continue;
if(count_common_roads(arr) == n - 1)
return arr;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |