# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442698 | Dan13llljws | Split the Attractions (IOI19_split) | C++14 | 157 ms | 16136 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
int read(){int s=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+ch-'0',ch=getchar();}return s*f;}
#define re read()
const int mod = 1e9 + 7, MM = 1e5 + 5;
struct E{int u, v;}e[MM<<1], bad[MM<<1];
int N, tb, cnt, cur, t, top, sz[MM], dsu[MM], w[MM]; vector<int> s, adj[MM]; pair<int,int> ord[3];
int Find(int x){return dsu[x] == x ? x : dsu[x] = Find(dsu[x]);}
void unite(int x, int y){x = Find(x), y = Find(y); sz[y] += sz[x], dsu[x] = y;}
int get_w(int src, int par){
w[src] = 1;
for (int v : adj[src])
if (v != par) w[src] += get_w(v, src);
return w[src];
}
int get_c(int src, int par){
for (int v : adj[src])
if (v != par && w[v] >= N / 2) return get_c(v, src);
return src;
}
void merge(int src, int par, int head){
if (Find(src) != Find(head)) unite(src, head);
for (int v : adj[src])
if (v != par) merge(v, src, head);
}
void paint(int src, int par){
if (s[src]) return;
cnt ? (s[src] = cur, cnt--) : s[src] = ord[2].second;
for (int v : adj[src])
# | 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... |