#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<=N;i++){
int prev=0;
vector<int> nw;
for(int j=1;j<=M;j++){
vector<int> cr;
for(int x:cur)cr.pb(x);
int l=prev,r=sz(cr)-1,rs=sz(cr);
while(l<=r){
int m=(l+r)/2;
vector<int> ask;
for(auto vec:res)ask.pb(vec[0]);
for(int j=0;j<=m;j++)ask.pb(cr[j]);
if(Query(ask)>=1){
r=m-1;
rs=m;
}
else{
l=m+1;
}
}
// cout<<rs<<" "<<sz(cur)<<"\n";
cur.erase(cr[rs]);
prev=rs;
nw.pb(cr[rs]);
}
res.pb(nw);
}
for(int i=0;i<M;i++){
vector<int> ans;
for(int j=0;j<N;j++){
ans.pb(res[j][i]);
}
Answer(ans);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
348 KB |
Output is correct |
3 |
Correct |
19 ms |
348 KB |
Output is correct |
4 |
Correct |
12 ms |
564 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
27 ms |
556 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
348 ms |
604 KB |
Output is correct |
2 |
Correct |
356 ms |
604 KB |
Output is correct |
3 |
Correct |
389 ms |
872 KB |
Output is correct |
4 |
Correct |
403 ms |
860 KB |
Output is correct |
5 |
Correct |
369 ms |
840 KB |
Output is correct |
6 |
Correct |
369 ms |
820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1100 ms |
1200 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |