Submission #1009098

# Submission time Handle Problem Language Result Execution time Memory
1009098 2024-06-27T08:44:39 Z PenguinsAreCute Chameleon's Love (JOI20_chameleon) C++17
40 / 100
15 ms 472 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
int query(vector<int> v) {
	for(auto &i: v) i++;
	return Query(v);
}
bool qry(vector<int> &v, int x) {
	int orig = query(v);
	v.push_back(x);
	int nw = query(v);
	v.pop_back();
	return (nw==orig);
}
int loving(int a, int x, int y, int z) {
	if(query({a,x,y})==1) return z;
	if(query({a,x,z})==1) return y;
	return x;
}
vector<int> adj[1005];
void Solve(int N) {
	for(int i=0;i<2*N;i++) for(int j=i+1;j<2*N;j++) if(query({i,j})==1) {
		adj[i].push_back(j);
		adj[j].push_back(i);
	}
	int love[2*N]; for(int i=0;i<2*N;i++) if(adj[i].size()==3) love[i]=loving(i,adj[i][0],adj[i][1],adj[i][2]);
	int pear[2*N]; for(int i=0;i<2*N;i++) {
		if(adj[i].size()==1) pear[i] = adj[i][0];
		else for(auto j: adj[i]) if(j!=love[i]&&love[j]!=i) pear[i]=j;
	}
	for(int i=0;i<2*N;i++) if(pear[i]>i) Answer(i+1,pear[i]+1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 472 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 472 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 472 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 472 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -