Submission #1322180

#TimeUsernameProblemLanguageResultExecution timeMemory
1322180aritro_September (APIO24_september)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define int ll

int solve(int n,int m,vector<int> f,vector<vector<int>> s){
    vector<vector<int>> child(n);
    for(int i=0;i<n;i++){
        if(f[i]!=-1) child[f[i]].push_back(i);
    }
    map<int,int> ind;
    //m=1
    int a[n-1];
    for(int i=0;i<n-1;i++) a[i]=s[0][i];
    for(int i=0;i<n-1;i++) ind[a[i]]=i;
    int ans=0;
    for(int i=0;i<n-1;i++){
        ans++;
        int node=a[i];
        int new_i=i;
        for(auto u:child[node]){
            new_i=max(new_i,ind[u]);
        }
        i=new_i;
    }
    return ans;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc05ON4N.o: in function `mtbpdhr2zxjo1o4i9oreohsbuzzl4s6u::taskcase()':
grader.cpp:(.text+0x513): undefined reference to `solve(int, int, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status