# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116156 | user202729 | Mousetrap (CEOI17_mousetrap) | C++17 | 2840 ms | 72668 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.
// https://oj.uz/problem/view/CEOI17_mousetrap
#ifndef _GLIBCXX_DEBUG
#define NDEBUG
#endif
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<functional>
#include<cassert>
int nn,trap,mouse;
std::vector<std::vector<int>> ad;
std::vector<int> par; // with root = trap
std::vector<int> nrock; // num of rock to put if mouse is trapped at [?]
// of course the mouse can only be trapped at nodes with <= 1 child (rooted somewhere)
void dfs1(int x){
int const px=par[x];
nrock[x]=nrock[px]+ad[x].size()-2;
for(int child:ad[x])if(child!=px){
par[child]=x;
dfs1(child);
}
}
std::vector<int> d1; // dist(?, line(trap, mouse))
std::vector<int> cost; // total cost if mouse is trapped at [?] = nrock + d1
# | 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... |