This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//
// Created by adavy on 8/18/2024.
//
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//#define int ll
#define f first
#define s second
vector<vector<int>> adj;
void dfs(int v, int p){
cout << "v: " << v << endl;
//int maxsz = -1, maxch = -1;
for(int u:adj[v]){
if (u == p) continue;
dfs(u,v);
}
}
signed main(){
int N,s; cin >> N >> s;
adj.resize(N+5);
for(int i=1;i<=N;++i){
ll x,p; cin >> x >> p;
//val[i] = x;
adj[p].push_back(i);
adj[i].push_back(p);
}
dfs(1,-1);
//int t = s;
/*
for(auto& item:sets[which[0]].ps){
if (t >= item.f){
t -= item.f;
t += item.s;
}
}*/
//cout << t-s << endl;
}
# | 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... |