//bs:sanitizers,flags:grader.cpp
#include "dango3.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
namespace x = __gnu_pbds;
template <typename T>
using ordered_set = x::tree<T, x::null_type, less<T>, x::rb_tree_tag, x::tree_order_statistics_node_update>;
template <typename T>
using normal_queue = priority_queue<T, vector<T>, greater<>>;
#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())
#define x first
#define y second
using ll = long long;
using ld = long double;
void rec(const vector<int> &inds, int m) {
// cout << m << ": ";
// for (int u : inds) {
// cout << u << " ";
// }
// cout << "\n";
if (m == 1) {
Answer(inds);
return;
}
int mid = m / 2;
vector<int> lef, rig = inds;
for (int i : inds) {
rig.erase(find(all(rig), i));
if (Query(rig) < mid) {
// cout << "" << i << " remains in rig" << endl;
rig.push_back(i);
} else {
// cout << "add " << i << " to lef" << endl;
lef.push_back(i);
}
}
rec(lef, m - mid);
rec(rig, mid);
}
void Solve(int n, int m) {
vector<int> inds(n * m);
iota(all(inds), 1);
rec(inds, m);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
7 ms |
340 KB |
Output is correct |
3 |
Correct |
8 ms |
340 KB |
Output is correct |
4 |
Correct |
9 ms |
340 KB |
Output is correct |
5 |
Correct |
8 ms |
340 KB |
Output is correct |
6 |
Correct |
7 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
165 ms |
448 KB |
Output is correct |
2 |
Correct |
189 ms |
428 KB |
Output is correct |
3 |
Correct |
196 ms |
424 KB |
Output is correct |
4 |
Correct |
199 ms |
476 KB |
Output is correct |
5 |
Correct |
182 ms |
448 KB |
Output is correct |
6 |
Correct |
154 ms |
440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
635 ms |
652 KB |
Output is correct |
2 |
Correct |
645 ms |
672 KB |
Output is correct |
3 |
Correct |
644 ms |
620 KB |
Output is correct |
4 |
Correct |
792 ms |
784 KB |
Output is correct |
5 |
Correct |
626 ms |
532 KB |
Output is correct |
6 |
Correct |
601 ms |
672 KB |
Output is correct |