#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-3) {
for (int ind = 1; ind <= i; ind++)
if (depth[ind] > depth[mx])
mx = ind;
return mx/1000;
}
if (i == N-2) {
if (depth[i] > depth[mx])
return 101;
else
return mx/10%100;
}
if (i == N-1) {
if (depth[i] > depth[mx])
return 101;
else
return mx%10;
}
return 0;
}
pair<int, int> longest_path(vector<int> S) {
for (int i = S.size()-1; i >= S.size()-2; i--)
if (S[i] == 101) {
return make_pair(0, i);
}
return make_pair(0, S[(int)S.size()-3]*1000 + S[(int)S.size()-2]*10 + S.back());
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |