답안 #933776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933776 2024-02-26T09:57:10 Z nguyentunglam 카멜레온의 사랑 (JOI20_chameleon) C++17
40 / 100
15 ms 2648 KB
#include "chameleon.h"
#include <vector>
#include<bits/stdc++.h>

using namespace std;

namespace {
const int NN = 1e3 + 10;

vector<int> adj[NN];

bool g[NN][NN];

int love[NN][NN];

void solve(int n) {
  for(int i = 1; i <= 2 * n; i++) for(int j = i + 1; j <= 2 * n; j++) {
    if (Query({i, j}) == 1) {
      adj[i].push_back(j);
      adj[j].push_back(i);
    }
  }
  int m = n, mx = 0;
  for(int i = 1; i <= n; i++) {
    int x = -1;
    for(int j = 0; j < m; j++) if (!g[j][i]) {
      x = j;
      break;
    }
    assert(x >= 0);
    mx = max(mx, x);
    for(int &v : adj[i]) g[x][v] = 1;
  }
  assert(mx <= 5);
//  cerr << mx << endl;
  for(int i = 1; i <= 2 * n; i++) {
    assert(adj[i].size() == 1 || adj[i].size() == 3);
    if (adj[i].size() == 1) continue;
    for(int &j : adj[i]) {
      vector<int> tmp;
      tmp.push_back(i);
      for(int &k : adj[i]) if (k != j) tmp.push_back(k);
      if (Query(tmp) == 1) {
        love[i][j] = 1;
      }
    }
  }
  for(int i = 1; i <= 2 * n; i++) {
    for(int &j : adj[i]) if (i < j && love[i][j] + love[j][i] == 0) {
      Answer(i, j);
    }
  }
}
}  // namespace


void Solve(int n) {
  ::solve(n);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 14 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 480 KB Output is correct
12 Correct 2 ms 2648 KB Output is correct
13 Correct 2 ms 2648 KB Output is correct
14 Correct 1 ms 2648 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 2 ms 2648 KB Output is correct
18 Correct 1 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 14 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -