Submission #1050046

# Submission time Handle Problem Language Result Execution time Memory
1050046 2024-08-09T07:00:48 Z 우민규(#11047) Chameleon's Love (JOI20_chameleon) C++17
4 / 100
20 ms 500 KB
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

int ask(vector<int>& b) {
  for (auto& e : b) e += 1;
  int res = Query(b);
  for (auto& e : b) e -= 1;
  return res;
}

int same_col(int a, vector<int> b) {
  if (b.size() == 1) return b.front();
  vector<int> bl, br;
  for (int i = 0; i < b.size(); ++i) {
    (i % 2 ? bl : br).push_back(b[i]);
  }
  int bl_c = ask(bl);
  bl.push_back(a);
  int bla_c = ask(bl);
  bl.pop_back();
  if (bla_c == bl_c) return same_col(a, bl);
  return same_col(a, br);
}

}  // namespace

void Solve(int n) {
  vector<int> b(2 * n, 0);
  iota(b.begin(), b.end(), 0);
  for (int i = 0; i < n; ++i) {
    int j = b.back();
    b.pop_back();

    int corr = same_col(j, b);

    b.erase(find(b.begin(), b.end(), corr));

    Answer(j + 1, corr + 1);
  }
}

#ifndef EVAL
#include "grader.cpp"
#endif

Compilation message

chameleon.cpp: In function 'int {anonymous}::same_col(int, std::vector<int>)':
chameleon.cpp:17:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for (int i = 0; i < b.size(); ++i) {
      |                   ~~^~~~~~~~~~
# 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 Correct 20 ms 500 KB Output is correct
4 Correct 11 ms 344 KB Output is correct
5 Correct 12 ms 480 KB Output is correct
6 Correct 12 ms 500 KB Output is correct
7 Correct 13 ms 468 KB Output is correct
8 Correct 13 ms 344 KB Output is correct
9 Correct 18 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 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 Correct 20 ms 500 KB Output is correct
4 Correct 11 ms 344 KB Output is correct
5 Correct 12 ms 480 KB Output is correct
6 Correct 12 ms 500 KB Output is correct
7 Correct 13 ms 468 KB Output is correct
8 Correct 13 ms 344 KB Output is correct
9 Correct 18 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB Wrong Answer [6]
12 Halted 0 ms 0 KB -