Submission

Status:

Compilation Error

Subtask/Task Score:

Score: 0

User: saganegadih

Problemset: รถไฟตู้เสบียง (Dining Car)

Language: cpp

Time: 0.000 second

Submitted On: 2026-05-31 23:54:05

#include <bits/stdc++.h>
#include "dining_car.h"

using namespace std;

// you can also write additional functions here

pair < int, int > locate_dining_cars(int N) 
{
  //write your code here

  //you can call "compare_cars(i,j)"
  int k;
  int init = compare_cars(1,N);
  int eq[2] = {1,N}
  if(init == -1){
      k = N
      while(compare_cars(1,k)!=0){
          k--;
      }
      eq = {1,k};
  }
  if(init == 1){
      k = 1
      while(compare_cars(k,N)!=0){
          k++;
      }
      eq = {k,N};
  }
  while(compare_cars(eq[0]+1,eq[1])==-1){
      eq[0]++;
      eq[1]--;
  }
  int max,min;
  if(eq[0]>eq[1]){
      max = eq[0]
      min = eq[1]
  }else{
      max = eq[1]
      min = eq[0]
  }

  return make_pair(min, max);
}