Submission #463715

#TimeUsernameProblemLanguageResultExecution timeMemory
463715oscar1fHighway Tolls (IOI18_highway)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "highway.h"
using namespace std;

#define int long long

const int MAX_SOM=90*1000;
int nbSom,bas,haut,nbAre,distTotal,petit,grand,mid,rep;
vector<int> quest;

void find_pair(int N,vector<int> U,vector<int> V,int A,int B) {
  nbAre=U.size();
  nbSom=N;
  bas=A;
  haut=B;
  for (int i=0;i<nbAre;i++) {
    quest.push_back(0);
  }
  distTotal=ask(quest);
  petit=0;
  grand=nbAre-distTotal;
  while(petit!=grand) {
    mid=(petit+grand)/2;
    for (int i=petit;i<=mid;i++) {
      quest[i]=1;
    }
    rep=ask(quest);
    for (int i=petit;i<=mid;i++) {
      quest[i]=0;
    }
    if (rep>distTotal) {
      grand=mid;
    }
    else {
      petit=mid+1;
    }
  }
  answer(petit,petit+distTotal);
}

Compilation message (stderr)

highway.cpp: In function 'void find_pair(long long int, std::vector<long long int>, std::vector<long long int>, long long int, long long int)':
highway.cpp:19:17: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   19 |   distTotal=ask(quest);
      |                 ^~~~~
In file included from highway.cpp:2:
highway.h:7:39: note: in passing argument 1 of 'long long int ask(const std::vector<int>&)'
    7 | long long ask(const std::vector<int> &w);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^
highway.cpp:27:13: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   27 |     rep=ask(quest);
      |             ^~~~~
In file included from highway.cpp:2:
highway.h:7:39: note: in passing argument 1 of 'long long int ask(const std::vector<int>&)'
    7 | long long ask(const std::vector<int> &w);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^