# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
490901 | MohammadAghil | Railway (BOI17_railway) | C++14 | 182 ms | 42248 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>
// #pragma GCC optimize ("Ofast")
// #pragma GCC target ("avx,avx2")
using namespace std;
typedef long long ll;
typedef pair<int, int> pp;
#define rep(i,l,r) for(int i = (l); i < r; i++)
#define per(i,r,l) for(int i = (r); i >= l; i--)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define ff first
#define ss second
const ll mod = 1e9 + 7, maxn = 2e5 + 2, inf = 1e9 + 5;
map<int, int> st[maxn];
int s[maxn], k;
vector<int> ro[maxn], ans;
vector<pp> adj[maxn];
void dfs(int r, int p){
for(pp c: adj[r]) if(c.ff != p){
dfs(c.ff, r);
if(sz(st[c.ff]) >= k) ans.pb(c.ss);
if(sz(st[r]) < sz(st[c.ff])) st[r].swap(st[c.ff]);
for(auto t: st[c.ff]){
st[r][t.ff] += t.ss;
if(st[r][t.ff] == s[t.ff]) st[r].erase(t.ff);
}
# | 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... |