# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1167423 | henriess | Chameleon's Love (JOI20_chameleon) | C++20 | 0 ms | 0 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);
}
}