Submission #1296080

#TimeUsernameProblemLanguageResultExecution timeMemory
1296080lukaye_19Stations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> label(int n, int k, vector<int> u, vector<int> v) 
{
  vector<int>labels(n);
  
  for (int i = 0; i < n; i++)
  {
    labels[i] = i;
  }
  
  return labels;
}

int ischild(int parent,int targetchild)
{
  while (parent > targetchild)
  {
    parent /= 2;
  }
  
  if (parent == targetchild)
  {
    return true;
  }
  
  return false;
}

int find_next_station(int s, int t, vector <int> c)
{
  if (c.size() == 1) return c[0];
  
  else if(s == 0){
      if (ischild(c[0],t)) return c[0];
      
      return c[1];
  }  
  else
  {
      if (ischild(c[1],t)) return c[1];
      
      if (c.size() == 3 && is_descendant(c[2],t)) return c[2];
      
      return c[0];
  }
}

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:46:28: error: 'is_descendant' was not declared in this scope
   46 |       if (c.size() == 3 && is_descendant(c[2],t)) return c[2];
      |                            ^~~~~~~~~~~~~