#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;
#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
//#define int long long
using i64 = long long;
template <class F, class _S>
bool chmin(F &u, const _S &v){
bool flag = false;
if ( u > v ){
u = v; flag |= true;
}
return flag;
}
template <class F, class _S>
bool chmax(F &u, const _S &v){
bool flag = false;
if ( u < v ){
u = v; flag |= true;
}
return flag;
}
void Solve(int n, int m){
vector <int> p, us(n * m + 1);
for ( int i = 1; i <= n * m; i++ ){
p.pb(i);
}
for ( int op = 1; op <= m; op++ ){
auto dfs = [&](auto dfs, int lst, auto &cur) -> void{
if ( lst == -1 ){
return;
}
int l = 0, r = lst;
while ( l < r ){
int md = (l + r) >> 1;
auto q = cur;
for ( int i = 0; i <= md; i++ ){
q.pb(p[i]);
}
if ( Query(q) ) r = md;
else l = md + 1;
}
us[p[l]] = true;
cur.pb(p[l]);
dfs(dfs, l - 1, cur);
};
vector <int> tmp;
dfs(dfs, (int)p.size() - 1, tmp);
Answer(tmp);
vector <int> nxt;
for ( int i = 1; i <= n * m; i++ ){
if ( !us[i] ){
nxt.pb(i);
}
} swap(p, nxt);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
540 KB |
Output is correct |
3 |
Correct |
8 ms |
348 KB |
Output is correct |
4 |
Correct |
9 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
604 KB |
Output is correct |
2 |
Correct |
46 ms |
656 KB |
Output is correct |
3 |
Correct |
211 ms |
684 KB |
Output is correct |
4 |
Correct |
208 ms |
604 KB |
Output is correct |
5 |
Correct |
26 ms |
480 KB |
Output is correct |
6 |
Correct |
22 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
125 ms |
760 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |