Submission #951661

#TimeUsernameProblemLanguageResultExecution timeMemory
951661PringSuper Dango Maker (JOI22_dango3)C++17
0 / 100
202 ms604 KiB
#include <bits/stdc++.h> using namespace std; #include "dango3.h" #define fs first #define sc second #define mp make_pair #define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++) typedef pair<int, int> pii; namespace { const int MXN = 405; int n, m; vector<int> cnt[MXN]; vector<int> v; int found = 1; vector<int> two; mt19937 rnd(time(nullptr)); int BSH(int id) { int l = 0, r = found; int ccc = 0; while (l + 1 < r) { int mid = (l + r) >> 1; FOR(i, mid, r) v.push_back(cnt[i].front()); int x = Query(v); FOR(i, mid, r) v.pop_back(); if (x == m - 2) r = mid; else l = mid; // assert(++ccc < 9); } return l; } void PUT(int id) { id = v.back(); int f = 0; v.pop_back(); for (auto &i : two) v.push_back(i); if (found == n) { BSH(id); return; } int x = Query(v); if (x == m - 1) { cnt[found].push_back(id); found++; } else { cnt[BSH(id)].push_back(id); two.push_back(id); f = 1; } FOR(i, 0, two.size() - f) v.pop_back(); } void miku() { FOR(i, 1, n * m) v.push_back(i); // shuffle(v.begin(), v.end(), rnd); cnt[0].push_back(n * m); for (int i = n * m - 1; i > 0; i--) PUT(i); FOR(i, 0, m) { vector<int> ans(n); FOR(j, 0, n) ans[j] = cnt[j][i]; Answer(ans); } } } void Solve(int N, int M) { ::n = N; ::m = M; miku(); }

Compilation message (stderr)

dango3.cpp: In function 'int {anonymous}::BSH(int)':
dango3.cpp:22:13: warning: unused variable 'ccc' [-Wunused-variable]
   22 |         int ccc = 0;
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...