Submission #951713

#TimeUsernameProblemLanguageResultExecution timeMemory
951713qwe1rt1yuiop1Super Dango Maker (JOI22_dango3)C++17
100 / 100
154 ms852 KiB
#include "dango3.h"
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;

namespace
{
  int variable_example = 1;
} // namespace

mt19937 rng(48763);

void Solve(int n, int m)
{
  vector<int> flag(n * m, 1);

  for (int ii = 0; ii < m; ++ii)
  {
    vector<int> todo;
    for (int i = 1; i <= n * m; ++i)
      if (flag[i - 1])
        todo.emplace_back(i);
    shuffle(all(todo), rng);

    int l = n, r = sz(todo);
    while (l < r)
    {
      int mid = (l + r) >> 1;
      vector<int> v;
      for (int i = 0; i < mid; ++i)
        v.emplace_back(todo[i]);
      if (Query(v))
        r = mid;
      else
        l = mid + 1;
    }
    vector<int> ans;
    for (int i = 0; i < l; ++i)
    {
      auto ans0 = ans;
      for (int j = i + 1; j < l; ++j)
        ans.emplace_back(todo[j]);
      if (Query(ans) == 0)
        ans0.emplace_back(todo[i]);
      ans = ans0;
    }
    Answer(ans);
    for (int i : ans)
      flag[i - 1] = 0;
  }
}

/*
3 2
3 3 1 2 1 2

*/

Compilation message (stderr)

dango3.cpp:9:7: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 |   int variable_example = 1;
      |       ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...