Submission #1199345

#TimeUsernameProblemLanguageResultExecution timeMemory
1199345santialt2Highway Tolls (IOI18_highway)C++20
Compilation error
0 ms0 KiB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define pb push_back
#define pll pair<ll, ll>
#define vs vector<string>
#define vb vector<bool>
#define all(aaa) aaa.begin(), aaa.end()	
#define rall(aaa) aaa.rbegin(), aaa.rend()
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ed "\n"
#define fi first
#define se second
ll MOD = 1e9+7;
/*
ll A, B, N, s_, t_;

ll ask(vl p){
	ll c = 0;
	ff(i, s_, t_){
		if(p[i] == 0){
			c += A;
		}
		else{
			c += B;
		}
	}
	cout << "ASK " << c << ed;
	for(ll q : p){
		cout << q;
	}
	cout << ed;
	return c;
}
ll qq = 0, qqq = 0;
void answer(ll a, ll b){
	qq = a;
	qqq = b;
	cout << ed << "==================  " << a << " " << b << ed;
}
*/
void find_pair(int n, vector<int> U, vector<int> V, int a, int b){
	ll m = U.size();
	vl empty(m, 0);
	ll dist = ask(empty);
	dist /= a;
	//cout << "DIST " << dist << ed;
	ll l = 0, r = m+1;
	while(r-l > 1){
		ll mid = (l+r)/2;
		vl cur = empty;
		fill(cur.begin(), cur.begin()+mid, 1);
		ll x = ask(cur);
		if(x == dist*a){
			//cout << "C1" << ed;
			l = mid;
		}
		else{
			//cout << "C2" << ed;
			r = mid;
		}
	}
	r--;
	//cout << "AAAAAAAAAAA " << r << " " << U[r] << ed;
	answer(r, r+dist);
	return;
}
/*
int main(){
	cin >> N >> A >> B >> s_ >> t_;
	vector<int> q1(N-1), q2(N-1);
	ff(i, 0, N-1){
		cin >> q1[i] >> q2[i];
	}
	find_pair(N, q1, q2, A, B);
	return 0;
}
*/

Compilation message (stderr)

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:48:23: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   48 |         ll dist = ask(empty);
      |                       ^~~~~
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:56:28: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   56 |                 ll x = ask(cur);
      |                            ^~~
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);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^