제출 #1362970

#제출 시각아이디문제언어결과실행 시간메모리
1362970SpyrosAliv카멜레온의 사랑 (JOI20_chameleon)C++20
40 / 100
18 ms4356 KiB
#include "chameleon.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {

int variable_example = 1;

}  // namespace

bool deb = false;

void dbg(vector<int> &x) {
  if (!deb) return;
  cout << "DEBUG: ";
  for (auto xx: x) cout << xx << " ";
  cout << "\n";
}

void Solve(int N) {
  int n = N;
  n *= 2;
  vector<vector<int>> cnt(n+1, vector<int>(n+1, 0));
  for (int i = 1; i <= n; i++) {
    vector<int> cands;
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      int tot = Query({i, j});
      if (tot == 1) {
        cands.push_back(j);
      }
    }
    dbg(cands);
    assert(cands.size() == 1 || cands.size() == 3);
    if (cands.size() == 1) {
      cnt[i][cands[0]] = cnt[cands[0]][i] = 1;
      continue;
    }
    vector<int> use;
    int totA = Query({cands[0], cands[1], i});
    int totB = Query({cands[0], cands[2], i});
    int totC = Query({cands[1], cands[2], i});
    if (totA == 1) use = {cands[0], cands[1]};
    else if (totB == 1) use = {cands[0], cands[2]};
    else if (totC == 1) use = {cands[1], cands[2]};
    else assert(false);
    cnt[i][use[0]]++;
    cnt[i][use[1]]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i+1; j <= n; j++) {
      if (cnt[i][j] && cnt[j][i]) Answer(i, j);
    }
  }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…