답안 #269682

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
269682 2020-08-17T08:28:07 Z 송준혁(#5099) 카멜레온의 사랑 (JOI20_chameleon) C++17
40 / 100
2 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<2*N; i++){
		for (int j=i+1; j<=2*N; j++){
			Q.clear(), Q.pb(i), Q.pb(j);
			if (Query(Q) == 1){
				adj[i].pb(j);
				adj[j].pb(i);
			}
		}
	}
	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 2 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 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Runtime error 2 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 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -