Submission #933773

# Submission time Handle Problem Language Result Execution time Memory
933773 2024-02-26T09:53:34 Z nguyentunglam Chameleon's Love (JOI20_chameleon) C++17
20 / 100
15 ms 600 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;
    assert(x >= 0);
    mx = max(mx, x);
    for(int &v : adj[i]) g[x][v] = 1;
  }
  assert(mx <= 10);
//  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);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 480 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 592 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 340 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 592 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 340 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 Runtime error 1 ms 600 KB Execution killed with signal 6
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 480 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 480 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -