#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());
void Solve(int N, int M){
vector<vector<int>> cur;
for(int i=1;i<=N*M;i++){
cur.pb({i});
}
int del=0;
while(del<M-1){
// cout<<sz(cur)<<"\n";
shuffle(all(cur),rng);
vector<int> ask;
vector<int> ok;
for(int i=0;i<sz(cur)-1;i++){
for(int j:cur[i])ask.pb(j);
}
for(int i=sz(cur)-2;i>=0;i--){
// for(int x:ask){
// cout<<x<<" ";
// }
// cout<<"\n";
// cout<<"! "<<Query(ask)<<"\n";
if(Query(ask)==M-1-del){
ok.pb(i);
}
for(int j=0;j<sz(cur[i]);j++)ask.ppb();
}
ok.ppb();
vector<int> vec=cur.back();
cur.ppb();
for(int i=0;i<sz(ok);i++){
for(int x:cur.back()){
vec.pb(x);
}
cur.ppb();
}
if(sz(vec)==N){
// assert(0);
// for(int x:vec)cout<<x<<" ";
// cout<<"\n";
// for(auto x:cur){
// for(int y:x)cout<<y<<" ";
// cout<<"\n";
// }
Answer(vec);
del++;
}
else{
cur.pb(vec);
}
}
vector<int> vec;
for(auto v:cur){
for(int x:v)vec.pb(x);
}
Answer(vec);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
344 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
348 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
144 ms |
860 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
303 ms |
1176 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |