Submission #1305100

#TimeUsernameProblemLanguageResultExecution timeMemory
1305100Math4Life2020Migrations (IOI25_migrations)C++20
Compilation error
0 ms0 KiB
#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[P[i]]+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};
}

Compilation message (stderr)

migrations.cpp: In function 'int send_message(int, int, int)':
migrations.cpp:12:16: error: 'P' was not declared in this scope
   12 |     mem[i]=mem[P[i]]+1;
      |                ^