# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
956026 | MarwenElarbi | Super Dango Maker (JOI22_dango3) | C++17 | 0 ms | 0 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 "dango3.h"
#include <vector>
namespace {
int variable_example = 1;
}
set<int> colors[25];
void Solve(int N, int M){
int n=N;
int m=M;
//cout <<n<<" "<<m<<endl;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
int l=-1;
int r=m-1;
while(r-l>1){
int mid=(r+l)/2;
vector<int> cur;
for (int k = 1; k <= n*m; ++k)
{
if(k==i*m+j+1) continue;
if(colors[mid].count(k)) continue;
cur.push_back(k);
}
int res=Query(cur);
if(m-res>1) l=mid;
else r=mid;
}
//for(auto u:colors[0]) cout <<u<<" ";
//cout <<endl;
vector<int> cur;
for (int k = 1; k <= n*m; ++k)
{
if(k==i*m+j+1) continue;
if(colors[r].count(k)) continue;
cur.push_back(k);
}
//cout <<r<<" "<<Query(cur)<<" "<<i*m+j+1<<" "<<i<<" "<<j<<endl;
colors[r].insert(i*m+j+1);
}
}
vector<int> ans[m];
for (int i = 0; i < m; ++i)
{
//cout <<colors[i].size()<<endl;
for(auto u:colors[i]) ans[i].push_back(u);
}
for (int i = 0; i < m; ++i)
{
Answer(ans[i]);
}
}