#include <bits/stdc++.h>
using namespace std;
int dep[10000], m = 0;
int send_message(int N, int i, int Pi) {
dep[i] = dep[Pi] + 1;
if (dep[i] > dep[m]) m = i;
if (i < N-15) return 0;
if (i == m) return 2;
return (m >> N-i-1) & 1;
}
pair<int,int> longest_path(std::vector<int> S) {
int n = S.size();
for (int i = n-1; i >= n-15; i--)
if (S[i] == 2)
return {0, i};
int ans = 0;
for (int i = S.size() - 15; i < S.size(); i++)
if (S[i] == 1)
ans |= 1 << (n-i-1);
return {0, ans};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |