This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Código de dango3 Saul
#include "dango3.h"
#include <vector>
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define pb push_back
using namespace std;
void Solve(int N, int M) {
vector<int> C[N], ans, pos, aux;
rep(i,0,N*M) pos.pb(i+1);
rep(i,0,N){
rep(j,0,M){
int l=0, r=pos.size(), mid;
while(l<=r){
mid=(l+r)>>1;
aux.clear();
rep(i,0,mid+1) aux.pb(pos[i]);
rep(k,0,i) aux.pb(C[k].back());
if(Query(aux)) r=mid-1;
else l=mid+1;
}
C[i].pb(pos[l]);
pos.erase(pos.begin()+l);
}
}
rep(i,0,M){
ans.clear();
rep(j,0,N) ans.pb({C[j][i]});
Answer(ans);
}
}
# | 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... |