제출 #528761

#제출 시각아이디문제언어결과실행 시간메모리
528761c28dnv9q3Monster Game (JOI21_monster)C++17
10 / 100
246 ms284 KiB
#include "monster.h"
#include <iostream>

namespace {

}  // namespace

std::vector<int> Solve(int N) {
  std::vector<int> T(N);
  std::vector<int> counter(N);

  for (int i = 0; i < N-1; i++) {
	  for (int j = i + 1; j < N; j++) {
		  if (Query(i, j)) {
			  counter[i]++;
		  }
		  else {
			  counter[j]++;
		  }
	  }
  }

  int a=-1, b=-1;
  for (int i = 0; i < N; i++) {
	  if (counter[i] == 1) {
		  if (a == -1) {
			  a = i;
		  }
		  else {
			  b = i;
		  }
	  }
  }
  if (Query(a, b)) {
	  counter[a] = 0;
  }
  else {
	  counter[b] = 0;
  }

  int x = -1, y = -1;
  for (int i = 0; i < N; i++) {
	  if (counter[i] == N-2) {
		  if (x == -1) {
			  x = i;
		  }
		  else {
			  y = i;
		  }
	  }
  }
  if (Query(x, y)) {
	  counter[y] = N-1;
  }
  else {
	  counter[x] = N-1;
  }

  return counter;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...