# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988576 | toan2602 | Super Dango Maker (JOI22_dango3) | C++17 | 317 ms | 600 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"
using namespace std;
vector<int> ans, v2, x;
bool mark[100005];
void Solve(int n, int m) {
for (int Q = 1; Q <= m; Q++) {
x.clear();
for (int i = n * m; i >= 1; i--) if(!mark[i]) x.push_back(i);
ans.clear();
v2 = x;
while(!x.empty()) {
int l = 0, r = x.size() - 1, mid, mx = 0;
while(l <= r) {
v2.clear();
mid = (l + r) / 2;
for (int i = 0; i < x.size() - mid; i++) {
v2.push_back(x[i]);
}
for (int i: ans) v2.push_back(i);
if(Query(v2) == 0) r = mid - 1;
else {
l = mid + 1;
mx = max(mx, mid);
}
}
for (int i = 1; i <= mx; i++) {
x.pop_back();
}
mark[x.back()] = true;
ans.push_back(x.back());
x.pop_back();
if(ans.size() == n) break;
}
Answer(ans);
}
}
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... |