Submission #464189

# Submission time Handle Problem Language Result Execution time Memory
464189 2021-08-12T13:33:12 Z koioi.org-dennisstar Chameleon's Love (JOI20_chameleon) C++17
40 / 100
24 ms 328 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;

void Solve(int n) {
	vector<vector<int>> adj(2*n+1);
	for (int i=1; i<2*n; i++) for (int j=i+1; j<=2*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) {
		if (adj[x].size()==1||adj[y].size()==1) return true;
		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<=2*n; i++) for (auto &j:adj[i]) if (chk(i, j)) {
		Answer(i, j);
		adj[j].clear();
		break;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Incorrect 24 ms 200 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 0 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 0 ms 200 KB Output is correct
9 Correct 0 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 0 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 0 ms 200 KB Output is correct
9 Correct 0 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 2 ms 200 KB Output is correct
13 Correct 2 ms 200 KB Output is correct
14 Correct 2 ms 200 KB Output is correct
15 Correct 2 ms 200 KB Output is correct
16 Correct 2 ms 200 KB Output is correct
17 Correct 2 ms 200 KB Output is correct
18 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Incorrect 24 ms 328 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Incorrect 24 ms 200 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -