#include "migrations.h"
#include <bits/stdc++.h>
#include <cassert>
#include <cstdio>
using namespace std;
int depth[10005];
int mx = 0;
int id = -1;
int k, l;
int send_message(int N, int i, int Pi) {
depth[i] = depth[Pi] + 1;
if(mx < depth[i]) {
mx = depth[i];
id = i;
}
if(i <= N - 20) {
k = mx;
if(i == N - 20) return 3;
return 0;
}
else {
if(mx > k) {
k = mx;
return 2;
}
else {
// if(l == 0) return 3;
int b = l % 2;
l = l / 2;
return b;
}
}
}
std::pair<int, int> longest_path(std::vector<int> S) {
// return {0, S.back()};
int res = 0;
for(int i = S.size() - 1; i >= 0; i--) {
if(S[i] == 2) {
return {0, i};
}
}
for(int i = S.size() - 1; i >= 0; i--) {
if(S[i] == 3) break;
res = res * 2 + S[i];
}
return {0, res};
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |