This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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});
q.push({a2, m/2+(m%2)});
}
return;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |