#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(s) (int)s.size()
#define ppb pop_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(1231229);
void Solve(int N, int M){
set<int> cur;
for(int i=1;i<=N*M;i++){
cur.insert(i);
}
vector<vector<int>> res;
for(int i=1;i<=M;i++){
int prev=0;
vector<int> nw;
for(int i=1;i<=N;i++){
int l=prev+1,r=N*M,rs=N*M;
while(l<=r){
int m=(l+r)/2;
vector<int> ask;
for(auto vec:res)ask.pb(vec[0]);
for(int x:cur){
if(x<=m)ask.pb(x);
}
if(Query(ask)>=1){
r=m-1;
rs=m;
}
else{
l=m+1;
}
}
cur.erase(rs);
prev=rs;
nw.pb(rs);
}
res.pb(nw);
}
for(int i=0;i<N;i++){
vector<int> ans;
for(int j=0;j<M;j++){
ans.pb(res[j][i]);
}
Answer(ans);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
452 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
348 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
189 ms |
616 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
522 ms |
1364 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |