# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
905214 | MinaRagy06 | Super Dango Maker (JOI22_dango3) | C++17 | 508 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "dango3.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long
void Solve(int n, int m) {
vector<int> v[m];
auto getmx = [&] (vector<int> &x) {
sort(x.begin(), x.end());
int ptr = 0;
vector<int> y;
for (int i = 1; i <= n * m; i++) {
while (ptr < x.size() && x[ptr] < i) {
ptr++;
}
if (ptr < x.size() && x[ptr] == i) continue;
y.push_back(i);
}
return Query(y);
};
for (int i = 1; i <= n * m; i++) {
int l = 0, r = m - 1;
while (l <= r) {
int md = ((l + r) >> 1);
v[md].push_back(i);
int mx = getmx(v[md]);
v[md].pop_back();
if (mx == 1) {
r = md - 1;
} else {
l = md + 1;
}
}
v[l].push_back(i);
}
for (auto i : v) {
Answer(i);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |