Submission #1167423

#TimeUsernameProblemLanguageResultExecution timeMemory
1167423henriessChameleon's Love (JOI20_chameleon)C++20
Compilation error
0 ms0 KiB

#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int N) {
	//if N is less than 7
	//I can brute force 
	//N <= 7, that means 
	//I can hold a meeting of 2 chameleons 
	//if 1 chameleons likes the other chameleon and the other chameleon does not, there will be 1 distinct color 
	//if both chameleons like each other, there will be 2 distinct colors 
	
	
	//ok wtv let's do st 1 first, where the both chameleons love each other 
	vector<pair<long long,long long>> pairs;
	for(int i = 1;i<=N;i++){
		vector<long long> qry(2);
		qry[0] = i;
		for(int j = i+1;j<=N;j++){
			qry[1] = j;
			long long r = Query(qry);
			if (r == 1){//that means 1 chameleon likes the other chameleon and that means both of them are originally different colors 
				//or both chameleons have the same color 
				//how do I differentiate between both situations 
				
				//when both chameleons love each other, there will be 2 different colors 
				
				pairs.push_back({i,j});
			}
				
		}
	}
	for(int i = 0;i<pairs.size();i++){
		Answer(pairs[i].first,pairs[i].second);
	}
}

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:21:45: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   21 |                         long long r = Query(qry);
      |                                             ^~~
In file included from chameleon.cpp:2:
chameleon.h:9:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    9 | int Query(const std::vector<int> &p);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^