답안 #269691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
269691 2020-08-17T08:35:20 Z 송준혁(#5099) 카멜레온의 사랑 (JOI20_chameleon) C++17
0 / 100
1 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[550];
}

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();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 416 KB Wrong Answer [1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 416 KB Wrong Answer [1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -