Submission #661269

# Submission time Handle Problem Language Result Execution time Memory
661269 2022-11-25T06:29:00 Z Alex_tz307 Super Dango Maker (JOI22_dango3) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
//#include "dango3.h"

using namespace std;

const int kLog = 4;

void Solve(int N, int M) {
  vector<vector<int>> groups(M);
  auto check = [&](const vector<int> &a) -> bool {
    vector<bool> mark(1 + N * M);
    for (const int &x : a) {
      mark[x] = true;
    }
    vector<int> q;
    for (int i = 1; i <= N * M; ++i) {
      if (!mark[i]) {
        q.emplace_back(i);
      }
    }
    int res = M - Query(q);
    return (res == 2);
  };
  for (int i = 1; i <= N * M; ++i) {
    int colour = 0;
    if (i != 1) {
      for (int k = kLog; k >= 0; --k) {
        int newColour = (colour | (1 << k));
        if (newColour < M) {
          groups[newColour - 1].emplace_back(i);
          if (check(groups[newColour - 1])) {
            colour = newColour;
          }
          groups[newColour - 1].pop_back();
        }
      }
    }
    groups[colour].emplace_back(i);
  }
  for (int i = 0; i < M; ++i) {
    Answer(groups[i]);
  }
}

Compilation message

dango3.cpp: In lambda function:
dango3.cpp:21:19: error: 'Query' was not declared in this scope
   21 |     int res = M - Query(q);
      |                   ^~~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:41:5: error: 'Answer' was not declared in this scope
   41 |     Answer(groups[i]);
      |     ^~~~~~