Submission #297735

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2977352020-09-11 20:56:36MoNsTeR_CuBeHighway Tolls (IOI18_highway)C++17
Compilation error
0 ms0 KiB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
void dfs(int node, int parent, vector< int > &index, vector< vector< pair<int,int> > > &Graph, int &curr, int lastEdge, vector< int > &EdgeToNode){
for(auto a: Graph[node]){
if(a.first == parent) continue;
dfs(a.first, node, index, Graph, curr, a.second, EdgeToNode);
}
index[curr++] = lastEdge;
if(lastEdge != -1) EdgeToNode[lastEdge] = node;
}
void search(int left, int right, int M, vector< int > &ans, vector< int > &EdgeToNode, vector< int > &index, int mark){
if(left == right){
ans.push_back(EdgeToNode[index[left]]);
return;
}
vector< int > toAsk(M,0);
int mid = (left+right)/2;
for(int i = 0; i<= mid; i++){
toAsk[index[i]] = 1;
//cout << EdgeToNode[index[i]] << ' ';
}
//cout << endl;
int rep = ask(toAsk);
if(rep > mark){
search(left, mid, M, ans,EdgeToNode,index, mark);
}else{
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

highway.cpp: In function 'void search(long long int, long long int, long long int, std::vector<long long int>&, std::vector<long long int>&, std::vector<long long int>&, long long int)':
highway.cpp:27:20: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   27 |      int rep = ask(toAsk);
      |                    ^~~~~
In file included from highway.cpp:1:
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: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:50:22: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   50 |       int mark = ask(toAsk);
      |                      ^~~~~
In file included from highway.cpp:1:
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);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^