Submission #1258201

#TimeUsernameProblemLanguageResultExecution timeMemory
1258201mkkkkkkkkMigrations (IOI25_migrations)C++20
30 / 100
28 ms456 KiB
#include "migrations.h"
#include <bits/stdc++.h>

using namespace std;

int dist[10000]={};
int last=0;

int send_message(int N, int i, int Pi)
{
    dist[i]=dist[Pi]+1;
    if(dist[i]>=dist[last])
    {
        last=i;

    }

    if(i-last==999)
        return 4;
    else if(i-last==99 && last>=9000)
    {
        return 3;
    }
    else if(i-last==9 && last>=9900)
    {
        return 2;
    }
    else if(i-last==0 && last>=9990)
    {
        return 1;
    }
    else
        return 0;

}

pair<int, int> longest_path(vector<int> S) {
  for(int i=S.size()-1;i>=0;i--)
  {
      if(S[i]!=0)
      {
          if(S[i]==4)
          {
              return {0,i-999};
          }
          else if(S[i]==3)
          {
              return {0,i-99};
          }
          else if(S[i]==2)
          {
              return {0,i-9};
          }
          else if(S[i]==1)
          {
              return {0,i};
          }
      }
  }
}

Compilation message (stderr)

migrations.cpp: In function 'std::pair<int, int> longest_path(std::vector<int>)':
migrations.cpp:60:1: warning: control reaches end of non-void function [-Wreturn-type]
   60 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...