#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
#include "dango3.h"
const int N=1e6+99;
int n,m,a[N];
void solve(vector<int> vec){
if(vec.size()==n) Answer(vec);
int m=vec.size()/n;
vector<int> vec0,vec1;
f_(i,vec.size()-1,0){
vector<int> pec=vec;
pec.erase(pec.begin()+i);
if(2*Query(pec)>=m){
vec0.pb(vec[i]);
vec=pec;
}
else{
vec1.pb(vec[i]);
}
}
solve(vec0);
solve(vec1);
}
void Solve(int _n, int _m){
n=_n,m=_m;
vector<int> vec(n*m);
iota(all(vec),1);
solve(vec);
}
/*
int32_t main(){
ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
}*/
Compilation message
dango3.cpp: In function 'void solve(std::vector<int>)':
dango3.cpp:29:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
29 | if(vec.size()==n) Answer(vec);
| ~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
540 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
452 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
555 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
880 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |