Submission #464169

# Submission time Handle Problem Language Result Execution time Memory
464169 2021-08-12T13:25:07 Z koioi.org-dennisstar Chameleon's Love (JOI20_chameleon) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

void Solve(int n) {
	vector<vector<int>> adj(n+1);
	for (int i=1; i<n; i++) for (int j=i+1; j<=n; j++) {
		vector<int> v(2);
		v[0]=i, v[1]=j;
		if (Query(v)==1) adj[i].emplace_back(j), adj[j].emplace_back(i);
	}
	auto chk = [&](int x, int y) {
		int f1=0, f2=0;
		vector<int> v(3);
		v[0]=x, v[1]=y;
		for (auto &i:adj[x]) if (i!=y) {
			v[2]=i;
			if (Query(v)==1) { f1=1; break; }
		}
		for (auto &i:adj[y]) if (i!=x) {
			v[2]=i;
			if (Query(v)==1) { f2=1; break; }
		}
		return f1&&f2;
	};
	for (int i=1; i<=n; i++) for (auto &j:adj[i]) if (chk(i, j)) {
		Answer(i, j);
		adj[j].clear();
		break;
	}
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:10:7: error: 'Query' was not declared in this scope
   10 |   if (Query(v)==1) adj[i].emplace_back(j), adj[j].emplace_back(i);
      |       ^~~~~
chameleon.cpp: In lambda function:
chameleon.cpp:18:8: error: 'Query' was not declared in this scope
   18 |    if (Query(v)==1) { f1=1; break; }
      |        ^~~~~
chameleon.cpp:22:8: error: 'Query' was not declared in this scope
   22 |    if (Query(v)==1) { f2=1; break; }
      |        ^~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:27:3: error: 'Answer' was not declared in this scope
   27 |   Answer(i, j);
      |   ^~~~~~