# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1075619 | edogawa_something | Simurgh (IOI17_simurgh) | C++17 | 14 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "simurgh.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
struct dsu {
ll pa[50];
void init(ll x) {
for(int i=0;i<=x;i++)
pa[i]=i;
}
ll get(ll x) {
if(x==pa[x])
return x;
return pa[x]=get(pa[x]);
}
bool unite(ll x,ll y) {
x=get(x),y=get(y);
if(x==y)
return 0;
pa[x]=y;
return 1;
}
}d;
std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> vv) {
for(int i=0;i<(1<<(u.size()));i++) {
if(__builtin_popcount(i)==n-1) {
vector<int>v;
d.init(n);
bool chk=1;
for(int bit=0;bit<u.size();bit++) {
if(((1<<bit)&i)) {
chk&=d.unite(u[bit],vv[bit]);
v.pb(bit);
}
}
if(chk) {
ll x=count_common_roads(v);
if(x==n-1) {
return v;
}
}
}
}
return {};
}
Compilation message (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... |