#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#include "dango3.h"
namespace {
int variable_example = 1;
} // namespace
void Solve(int N, int M) {
int n,m;
n = N;
m = M;
vector<vector<int>> ans;
vector<int> fq;
ans.resize(m);
fq.resize(n*m+1,0);
for(int i = 1; i <= n*m; i++) {
int l = 0;
int r = m-1;
while(l < r) {
int mid = (l+r)>>1;
for(int j = l; j <= mid; j++) {
for(auto x : ans[j]) fq[x]++;
}
vector<int> vc;
for(int j = 1; j <= n*m; j++) {
if(fq[j] == 0 && i != j) vc.pb(j);
}
for(int j = l; j <= mid; j++) {
for(auto x : ans[j]) fq[x]--;
}
int apmx = m-Query(vc);
if(apmx <= mid-l+1) {
r = mid;
}
else {
l = mid+1;
}
}
ans[l].pb(i);
}
for(int i = 0; i < m; i++) {
Answer(ans[i]);
}
return;
std::vector<int> x(3);
x[0] = 1;
x[1] = 2;
x[2] = 3;
variable_example = Query(x);
for (int i = 0; i < M; i++) {
std::vector<int> a(N);
for (int j = 0; j < N; j++) {
a[j] = N * i + j + 1;
}
Answer(a);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
340 KB |
Output is correct |
2 |
Correct |
30 ms |
368 KB |
Output is correct |
3 |
Correct |
30 ms |
372 KB |
Output is correct |
4 |
Correct |
30 ms |
340 KB |
Output is correct |
5 |
Correct |
28 ms |
340 KB |
Output is correct |
6 |
Correct |
27 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
963 ms |
588 KB |
Output is correct |
2 |
Correct |
973 ms |
464 KB |
Output is correct |
3 |
Correct |
993 ms |
476 KB |
Output is correct |
4 |
Correct |
954 ms |
564 KB |
Output is correct |
5 |
Correct |
948 ms |
468 KB |
Output is correct |
6 |
Correct |
931 ms |
448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3904 ms |
688 KB |
Output is correct |
2 |
Correct |
3941 ms |
660 KB |
Output is correct |
3 |
Correct |
3780 ms |
528 KB |
Output is correct |
4 |
Correct |
3811 ms |
600 KB |
Output is correct |
5 |
Correct |
3773 ms |
720 KB |
Output is correct |
6 |
Correct |
3691 ms |
784 KB |
Output is correct |