#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){
vector<vector<int>> cur;
for(int i=1;i<=N*M;i++){
cur.pb({i});
}
int del=0;
while(del<M-1){
// cout<<"! "<<del<<"\n";
// for(vector<int> vec:cur){
// for(int x:vec)cout<<x<<" ";
// cout<<"\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--){
if(Query(ask)==M-1-del){
ok.pb(i);
}
else break;
for(int j=0;j<sz(cur[i]);j++)ask.ppb();
}
if(sz(ok)==1){
vector<int> vec=cur.back();
cur.ppb();
for(int x:vec){
cur.pb({x});
}
}
// cout<<"? "<<sz(ok)<<"\n";
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 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
91 ms |
352 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
475 ms |
876 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
918 ms |
1264 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |