Submission #751902

# Submission time Handle Problem Language Result Execution time Memory
751902 2023-06-01T18:31:30 Z puppy Chameleon's Love (JOI20_chameleon) C++17
40 / 100
20 ms 348 KB
#include "chameleon.h"
#include <vector>
#include <cassert>
#include <iostream>
using namespace std;
namespace {

int variable_example = 1;
int love[1005];
int by[1005];
vector<int> one[1005];
bool used[1005];
}  // namespace

void Solve(int N) {
  if (N == 2) {
    for (int i = 1; i <= 2 * N; i++) {
        for (int j = i + 1; j <= 2 * N; j++) {
            vector<int> v; v.push_back(i); v.push_back(j);
            if (Query(v) == 1) {
                Answer(i, j);
            }
        }
    }
    return;
  }
  for (int i = 1; i <= 2 * N; i++) {
    for (int j = 1; j <= 2 * N; j++) {
        if (i == j) continue;
        vector<int> v; v.push_back(i); v.push_back(j);
        if (Query(v) == 1) one[i].push_back(j);
    }
    if (one[i].size() == 1) {
        int tst = one[i][0];
        if (used[i] || used[tst]) continue;
        Answer(i, tst);
        used[i] = true;
        used[tst] = true;
    }
    else {
        for (int p = 0; p < 3; p++) {
            for (int q = p + 1; q < 3; q++) {
                vector<int> v;
                v.push_back(i); v.push_back(one[i][p]); v.push_back(one[i][q]);
                if (Query(v) == 1) {
                    love[i] = one[i][3-p-q];
                }
            }
        }
    }
  }
  for (int i = 1; i <= 2 * N; i++) by[love[i]] = i;
  for (int i = 1; i <= 2 * N; i++) {
    if (used[i]) continue;
    int to = -1;
    to = one[i][0] + one[i][1] + one[i][2] - love[i] - by[i];
    Answer(i, to);
    used[i] = used[to] = true;
  }
}

Compilation message

chameleon.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Incorrect 18 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 0 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 0 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 336 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 3 ms 336 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
16 Correct 3 ms 336 KB Output is correct
17 Correct 3 ms 336 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Incorrect 20 ms 336 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Incorrect 18 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -