// 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) / m) >> 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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
392 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
229 ms |
804 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
919 ms |
908 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |