#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
//~ #define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vii;
/* __ __ __ */
/* ====== _ /| /| __ _ / | | /| | @ | | | | / /| |\ | / | | @ | / */
/* || |_| |_ / |/ | | | |_ |- | |--| /-| | | \ \ |==| |- /=| | \ | | |--| | |- */
/* || | | |_ / | |__| _| |_ \__ | | / | |__ | __| | | | \ / | | \| \__ | | | | \ */
/* */
void Solve(int N, int M) {
queue<pair<vi, int> > q;
vi v;
vector<vi> ans;
for(int i = 1; i <= N*M; i++){
v.pb(i);
}
q.push({v, M});
while(q.empty()){
auto [a, m] = q.front();
q.pop();
if(m <= 1){
Answer(a);
continue;
}
int n = a.size();
int us[n]{};
for(int i = 0; i < n; i++){
us[i] = 1;
vi res;
for(int j = 0; j < n; j++){
if(!us[j])res.pb(a[j]);
}
if(Query(res) < m/2)us[i] = 0;
}
vi a1, a2;
for(int i = 0; i < n; i++){
if(!us[i])a1.pb(a[i]);
else a2.pb(a[i]);
}
q.push({a1, m/2});
if(m&1)q.push({a2, m/2+1});
else q.push({a2, m/2});
}
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
496 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |