Submission #503547

# Submission time Handle Problem Language Result Execution time Memory
503547 2022-01-08T10:35:13 Z Koosha_mv Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
#include "library.h"

const int N=1e6+99;

int n,t,a[N];
vector<int> res,g[N];
vector<pair<int,int> > ans;

void dfs(int u,int p){
	res.pb(u+1);
	for(auto v : g[u]){
		if(u==v) continue ;
		dfs(v,u);
	}
}
/*int ask(int l,int r){
	vector<int> v(n);
	f(i,l,r+1) v[i]=1;
	int res=r-l+1-Query(v);
	for(auto p : ans){
		if(l<=p.F && p.F<=r && l<=p.S && p.S<=r){
			res--;
		}
	}
	return res;
}*/
int ask(int u,int v){
	vector<int> vec(n);
	vec[u]=1,vec[v]=1;
	return Query(v);
}
void Solve(int n){
	f(i,0,n){
		f(j,i+1,n){
			if(ask(i,j)==1){
				g[i].pb(j);
				g[j].pb(i);
			}
		}
	}
	f(i,0,n){
		if(g[i].size()==1){
			dfs(i,i);
			Answer(res);
		}
	}
}

Compilation message

library.cpp: In function 'int ask(int, int)':
library.cpp:51:15: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'int'
   51 |  return Query(v);
      |               ^
In file included from library.cpp:22:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^