# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671330 | birthdaycake | Race (IOI11_race) | C++17 | 483 ms | 110712 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 "race.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int,int>>adj[200001];
int dsu[200001],sz[200001];
int inbut[200001][2], ll[200001];
map<int,int> store[200001];
int vs[200001],sum[200001];
int ans = INT_MAX, K;
int Find(int x){
if(dsu[x] == x) return x;
else return dsu[x] = Find(dsu[x]);
}
void Unite(int a, int b, int cur_k, int cur_depth){
a = Find(a); b = Find(b);
if(sz[a] > sz[b]) swap(a,b);
sz[b] += sz[a];
dsu[a] = b;
for(auto s: store[a]){
if(store[b].count(cur_k - s.first) != 0){
ans = min(ans, s.second - cur_depth + store[b][cur_k - s.first] - cur_depth);
}
}
for(auto s: store[a]){
if(store[b].count(s.first) == 0 or store[b][s.first] > s.second){
# | 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... |