답안 #448721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
448721 2021-08-01T03:52:29 Z kimjg1119 카멜레온의 사랑 (JOI20_chameleon) C++17
0 / 100
1 ms 200 KB
#include "chameleon.h"
#include <bits/stdc++.h>

using namespace std;

int N;
vector<int> chk(1010);

void f(int x){
	int left = 0;
	for(int i=1;i<=N*2;i++) if(!chk[i]) left++;
	auto mchk = chk;
	
	while(left >= 2){
		int mid = left / 2;
		vector<int> v;
		v.push_back(x);
		for(int i=1;i<=N*2;i++){
			if(!mchk[i]) v.push_back(i);
			if(v.size() == mid + 1) break;
		}
		int ret = Query(v);
		if(ret == mid){
			int cnt = 0;
			for(int i=1;i<=N*2;i++){
				if(mchk[i]) continue;
				if(cnt < mid) cnt++;
				else mchk[i] = 1;
			}
			left = mid;
		}
		else{
			int cnt = 0;
			for(int i=1;i<=N*2;i++){
				if(mchk[i]) continue;
				cnt++; mchk[i] = 1;
				if(cnt == mid) break;
			}
			left = left - mid;
		}
	}
	
	for(int i=1;i<=N*2;i++){
		if(!mchk[i]){
			Answer(x, i);
			chk[i] = 1;
			break;
		}
	}
}

void Solve(int n){
	N = n;
	for(int i = 1; i <= N * 2; i++){
		if(chk[i]) continue;
		chk[i] = 1;
		f(i);
	}
}

Compilation message

chameleon.cpp: In function 'void f(int)':
chameleon.cpp:20:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |    if(v.size() == mid + 1) break;
      |       ~~~~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Incorrect 1 ms 200 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Incorrect 1 ms 200 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -