Submission #1256171

#TimeUsernameProblemLanguageResultExecution timeMemory
1256171TheScrasseMigrations (IOI25_migrations)C++20
10 / 100
29 ms456 KiB
#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 110

#include "migrations.h"

vector<ll> parent, dist;
array<ll, 2> opt = {-INF, -1};

int send_message(int N, int i, int Pi) {
    if (parent.empty()) {
        parent.resize(N, -1);
        dist.resize(N, 0);
    }
    
    dist[i] = dist[Pi] + 1;
    opt = max(opt, {dist[i], i});
    if (i == N - 1) return opt[1];
    return 0;
}

std::pair<int, int> longest_path(std::vector<int> S) {
    return {0, S.back()};
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...