# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
883817 | vjudge1 | Putovanje (COCI20_putovanje) | C++17 | 1029 ms | 39496 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;
#define sp << " " <<
#define int long long
#define vi vector<int>
#define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++)
#define pii pair<int,int>
const int N = 2e5+1;
int t = 1;
vi edges[N],v(N),w(N),pass(N,0);
set<int> sts[N];
map<pii,int> edg;
int n;
void dfs(int node,int p) {
for (auto it : edges[node]) if (it != p) dfs(it,node);
for (auto it : edges[node]) {
if (it == p) continue;
for (auto itt : sts[it]) {
int c = (itt>1)+(itt<n);
c-=(itt>1 && sts[it].count(itt-1));
c-=(itt<n && sts[it].count(itt+1));
pass[edg[{node,it}]]+=c;
}
}
sts[node].insert(node);
for (auto it : edges[node]) {
if (it == p) continue;
if (sts[it].size() > sts[node].size()) sts[node].swap(sts[it]);
for (auto itt : sts[it]) sts[node].insert(it);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |