#include "migrations.h"
#include <bits/stdc++.h>
using namespace std;
using ll = int; using pii = pair<ll,ll>;
const ll Nm = 10000;
ll dmax = -1; ll cstr = -1; //max distance to 0, construction
vector<ll> mem(Nm,0);
int send_message(int N, int i, int Pi) {
mem[i]=mem[Pi]+1;
if (i<9992) {
if (mem[i]>dmax) {
dmax = mem[i];
cstr = i;
}
return 0;
} else {
if (mem[i]>dmax) {
return 0;
}
ll T = 9999-i;
return (((cstr>>(2*T))&3)+1);
}
}
pair<int,int> longest_path(vector<int> S) {
ll N = S.size();
ll ans = 0;
for (ll i=9999;i>=9992;i--) {
if (S[i]==0) {
return {0,i};
}
ll T = 9999-i;
ans += (S[i]-1)<<(2*T);
}
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... |