Submission #269692

# Submission time Handle Problem Language Result Execution time Memory
269692 2020-08-17T08:36:20 Z 송준혁(#5099) Chameleon's Love (JOI20_chameleon) C++17
20 / 100
34 ms 512 KB
#include "chameleon.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

namespace {
	vector<int> adj[1010];
}

void Solve(int N) {
	vector<int> Q;
	for (int i=1; i<=N; i++){
		int l=N+1, h=2*N, k;
		while (1){
			k=0;
			while (l<=h){
				int m=(l+h)>>1;
				Q.clear(), Q.pb(i);
				for (int j=l; j<=m; j++) Q.pb(j);
				if (Query(Q) <= m-l+1) k=m, h=m-1;
				else l=m+1; 
			}
			if (!k) break;
			adj[i].pb(k), adj[k].pb(i);
			l=k+1, h=2*N;
		}
	}
	for (int i=1; i<=2*N; i++){
		if (adj[i].size() == 1) continue;

		Q.clear(), Q.pb(i), Q.pb(adj[i][0]), Q.pb(adj[i][1]);
		if (Query(Q) == 1) {adj[i].pop_back(); continue;}

		swap(adj[i][1], adj[i][2]);
		Q.clear(), Q.pb(i), Q.pb(adj[i][0]), Q.pb(adj[i][1]);
		if (Query(Q) == 1) {adj[i].pop_back(); continue;}

		swap(adj[i][0], adj[i][2]);
		adj[i].pop_back();
	}
	for (int i=1; i<=2*N; i++){
		if (adj[i].empty()) continue;
		int x;
		if (adj[adj[i][0]][0] == i) x=adj[i][0];
		else if (adj[adj[i][0]].size()>1 && adj[adj[i][0]][1] == i) x=adj[i][0];
		else x=adj[i][1];
		Answer(i, x);
		adj[x].clear();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 34 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Wrong Answer [1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Wrong Answer [1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 29 ms 384 KB Output is correct
4 Correct 29 ms 384 KB Output is correct
5 Correct 30 ms 384 KB Output is correct
6 Correct 30 ms 384 KB Output is correct
7 Correct 31 ms 504 KB Output is correct
8 Correct 29 ms 384 KB Output is correct
9 Correct 34 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 34 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -