Submission #1303198

#TimeUsernameProblemLanguageResultExecution timeMemory
1303198SabaKharebavaMigrations (IOI25_migrations)C++20
0 / 100
28 ms476 KiB
#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-2) {
        for (int ind = 1; ind <= i; ind++)
            if (depth[ind] > depth[mx])
                mx = ind;
        return mx/1000;
    }
    if (i == N-1) {
        if (depth[i] > depth[mx])
            return 100;
        else
            return mx%100;
    }
    return 0;
}

pair<int, int> longest_path(vector<int> S) {
    if (S.back() == 100)
        return make_pair(0, (int)(S.size()-1));
    return make_pair(0, S[(int)S.size()-2]*1000 + S[(int)S.size()-1]);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...