#include<bits/stdc++.h>
using namespace std;
#define pb push_back
int p[10001], depth[10001];
int mx = 0;
int send_message(int N, int i, int Pi) {
p[i] = Pi;
depth[i] = depth[Pi]+1;
if (i == N-2 && N > 100) {
for (int ind = 1; ind <= i; ind++)
if (depth[ind] > depth[mx])
mx = ind;
return mx/1000;
}
if (i == N-1) {
if (depth[i] > depth[mx])
return 101;
else
return mx%1000;
}
return 0;
}
pair<int, int> longest_path(vector<int> S) {
if (S.back() == 101)
return make_pair(0, (int)(S.size()-1));
return make_pair(0, S[(int)S.size()-2]*1000 + S[(int)S.size()-1]);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |