#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;
}else{
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]==0)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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |