#include <bits/stdc++.h>
using namespace std;
#define sz(v) int(std::size(v))
#include "dango3.h"
vector<int> operator+(vector<int> one, const vector<int> two) {
one.insert(end(one), begin(two), end(two));
return one;
}
void Solve(int n, int m) {
vector<int> v(n * m);
iota(begin(v), end(v), 1);
mt19937 rng(1234);
for (int rep = 0; rep < m; rep++) {
for (int i = 0; i < sz(v); i++) swap(v[i], v[rng() % (i + 1)]);
int low = n, hi = sz(v);
while (low < hi) {
int mid = (low + hi) / 2;
if (Query(vector(begin(v), begin(v) + mid))) hi = mid;
else low = mid + 1;
}
vector<int> one, two;
for (int i = low - 1; i >= 0; i--) {
if (Query(vector(begin(v), begin(v) + i) + one)) two.push_back(v[i]);
else one.push_back(v[i]);
}
Answer(one);
v = two + vector(begin(v) + low, end(v));
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
648 KB |
Output is correct |
2 |
Correct |
28 ms |
860 KB |
Output is correct |
3 |
Correct |
26 ms |
604 KB |
Output is correct |
4 |
Correct |
23 ms |
856 KB |
Output is correct |
5 |
Correct |
27 ms |
600 KB |
Output is correct |
6 |
Correct |
37 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
105 ms |
740 KB |
Output is correct |
2 |
Correct |
105 ms |
860 KB |
Output is correct |
3 |
Correct |
103 ms |
748 KB |
Output is correct |
4 |
Correct |
124 ms |
600 KB |
Output is correct |
5 |
Correct |
97 ms |
764 KB |
Output is correct |
6 |
Correct |
133 ms |
744 KB |
Output is correct |