# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
638120 | fadi57 | Super Dango Maker (JOI22_dango3) | C++17 | 4386 ms | 1220 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"
//#include "grader.cpp"
using namespace std;
vector<int>ans[30];
int done[100000+9];
int n,m;
bool check(int idx,int x){
memset(done,0,sizeof(done));
vector<int>v;
done[x]=1;
for(auto it:ans[idx]){
done[it]=1;
}
for(int i=1;i<=n*m;i++){
if(done[i]){
continue;
}
v.push_back(i);
}
return (Query(v)==m-2);
}
void Solve(int N, int M) {
int cnt=0;
n=N; m=M;
int maxi=0;
for(int i=1;i<=N*M;i++){
int st=1; int en=maxi; int last=0;
while(st<=en){
int mid=(st+en)/2;
if(check(mid,i)){
last=mid;
st=mid+1;
}else{
en=mid-1;
}
}
ans[last+1].push_back(i);
maxi=max(maxi,last+1);
}
for(int i=1;i<=m;i++){
Answer(ans[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... |