# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
946996 | vjudge1 | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 433 ms | 524288 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;
const int maxn=200000+10;
long long mainres,n,p[maxn],h[maxn],c[maxn];
vector<long long>adj[maxn];
set<pair<long long,long long>>dp[maxn];
void vorod(){
cin>>n;
for(long long i=1;i<=n;i++){
cin>>p[i]>>h[i]>>c[i];
mainres+=c[i];
if(i!=p[i]){
adj[p[i]].push_back(i);
}
}
}
void merge(long long u,long long v){
long long fu=u;
if((long long)dp[u].size()<(long long)dp[v].size()){
swap(u,v);
}
for(auto x:dp[v]){
auto y=*dp[u].lower_bound(make_pair(x.first,-1));
if(y.first==x.first){
dp[u].erase(y);
y.second+=x.second;
dp[u].insert(y);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |