#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(v) (int)v.size()
namespace {
} // namespace
void Solve(int n, int m){
vector< vector<int> > v;
vector<int> temp;
for(int i = n*m; i >= 1; i--)temp.push_back(i);
for(int i = 1; i <= n*m; i++){
temp.pop_back();
int l = 0, r = sz(v);
while(l!=r){
int mid = (l+r)/2;
int qtd = 0;
for(int j = mid+1; j < sz(v); j++)
for(int k = 0; k < sz(v[j]); k++){
temp.push_back(v[j][k]);
qtd++;
}
if(Query(temp) == m-mid-1)r = mid;
else l = mid+1;
while(qtd--)temp.pop_back();
}
if(l == sz(v))v.push_back({i});
else v[l].push_back(i);
}
for(int i = 0; i < sz(v); i++)Answer(v[i]);
}
# | 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... |