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;
/* __ __ __ */
/* ====== _ /| /| __ _ / | | /| | @ | | | | / /| |\ | / | | @ | / */
/* || |_| |_ / |/ | | | |_ |- | |--| /-| | | \ \ |==| |- /=| | \ | | |--| | |- */
/* || | | |_ / | |__| _| |_ \__ | | / | |__ | __| | | | \ / | | \| \__ | | | | \ */
/* */
vector<vi> ans;
void rec(vi v, int m){
if(m == 1){
ans.pb(v);
return;
}
vi a1, a2;
while(!v.empty()){
int res = v.back();
v.pop_back();
for(int i:a1)v.pb(i);
int x = Query(v);
int k = a1.size();
while(k--)v.pop_back();
if(x > m/2+(m&1)){
a2.pb(res);
}else{
a1.pb(res);
}
}
rec(a1, m/2+(m&1));
rec(a2, m/2);
}
void Solve(int N, int M) {
vi v;
for(int i = 0; i < N*M; i++){
v.pb(i);
}
rec(v, M);
for(auto i:ans){
Answer(i);
}
}
# | 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... |