답안 #444744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
444744 2021-07-15T03:44:59 Z ics0503 카멜레온의 사랑 (JOI20_chameleon) C++17
0 / 100
54 ms 292 KB
#include "chameleon.h"
#include <vector>
using namespace std;

void validation(int n, int i, int j) {
	vector<int>qr;
	for (int p = 1; p <= 2 * n; p++) {
		if (i == p || j == p)continue;
		qr.push_back(p);
	}
	int Q = Query(qr);
	if (Q != n) Answer(i, j);
}

void S4(int who, vector<int>Y,int n) {
	int sz = Y.size(), i, j;
	if (sz == 1) {
		validation(n, who, Y[0]);
		return;
	}
	vector<int>L, R;
	for (i = 0; i < sz / 2; i++)L.push_back(Y[i]);
	for (i = sz/2; i < sz; i++)R.push_back(Y[i]);
	L.push_back(who); R.push_back(who);
	int a = Query(L);
	int b = Query(R);
	L.pop_back(); R.pop_back();
	if (a != L.size() + 1)S4(who, L, n);
	if (b != R.size() + 1)S4(who, R, n);
}


void Solve(int n) {
	int i, j;
	for (i = 1; i <= n; i++) {
		vector<int>Y;
		for (j = n + 1; j <= n + n; j++)Y.push_back(j);
		S4(i, Y, n);
	}
}

Compilation message

chameleon.cpp: In function 'void S4(int, std::vector<int>, int)':
chameleon.cpp:28:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  if (a != L.size() + 1)S4(who, L, n);
      |      ~~^~~~~~~~~~~~~~~
chameleon.cpp:29:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  if (b != R.size() + 1)S4(who, R, n);
      |      ~~^~~~~~~~~~~~~~~
chameleon.cpp:16:24: warning: unused variable 'j' [-Wunused-variable]
   16 |  int sz = Y.size(), i, j;
      |                        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Incorrect 41 ms 200 KB Wrong Answer [3]
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 [7]
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 [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Incorrect 54 ms 292 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Incorrect 41 ms 200 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -