# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411678 | Dormi | Travelling Merchant (CCO21_day2problem1) | C++14 | 245 ms | 35588 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;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
int sz(const T &a){return int(a.size());}
const int MN=2e5+1;
int outdeg[MN];
vector<pair<pii,pii>> in[MN];
bool pruned[MN];
int te[MN],val[MN];
bool done[MN];
void pruneedge(const pair<pair<pii,pii>,int> &teedge){
if(done[teedge.second])return;
done[teedge.second]=true;
pair<pii,pii> edge=teedge.first;
te[edge.first.first]=min(te[edge.first.first],max(edge.second.first,val[edge.first.second]-edge.second.second));
outdeg[edge.first.first]--;
if(outdeg[edge.first.first]==0){
val[edge.first.first]=te[edge.first.first];
pruned[edge.first.first]=true;
for(auto x:in[edge.first.first]){
pruneedge({{{x.first.first,edge.first.first},x.second},x.first.second});
}
}
}
int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(false);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |