This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// oooo
/*
har chi delet mikhad bebar ~
gitar o ba khodet nabar! ~
;Amoo_Hasan;
*/
#include<bits/stdc++.h>
#include "dango3.h"
//#pragma GCC optimize("O3,no-stack-protector,unroll-loops")
//#pragma GCC target("avx2,fma")
using namespace std;
typedef long long ll;
typedef long double ld;
#define Sz(x) int((x).size())
#define All(x) (x).begin(), (x).end()
#define wtf(x) cout<<#x <<" : " <<x <<endl
constexpr ll inf = 1e18, N = 1e6 + 10, mod = 1e9 + 7, pr = 1000696969;
int n, m;
bool mark[N], vis[N];
void dojob(vector<int> vc) {
if(Sz(vc) == n) {
Answer(vc);
return;
}
int mid = (Sz(vc) / n) >> 1;
vector<int> ans, ans2;
for(auto i : vc) vis[i] = mark[i] = 0;
int tim = Sz(vc) / n;
while(Sz(ans) != n * mid) {
vector<int> ad;
int x = -1;
for(auto i : vc) {
if(!mark[i]) {
if(x == -1 && !vis[i]) {
x = i;
vis[i] = 1;
continue;
}
ad.push_back(i);
}
}
int cur = Query(ad);
if(cur >= (tim - mid)) {
mark[x] = 1;
ans.push_back(x);
}
}
for(auto i : vc) {
if(!mark[i]) ans2.push_back(i);
}
dojob(ans), dojob(ans2);
}
void Solve(int N, int M) {
n = N, m = M;
vector<int> vc;
for(int i = 1; i <= n * m; i++) vc.push_back(i);
dojob(vc);
}
# | 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... |