#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n, m;
} // namespace
int my_query(vector<int> &V){
vector<int> Q;
int pt = 0;
for (int i=1;i<=n*m;i++){
if (pt<(int)V.size() && V[pt]==i){pt++; continue;}
Q.push_back(i);
}
return m - Query(Q);
}
void dnc(vector<int> &V){
assert(V.size()%n==0);
int need = V.size() / n;
if (need==1){
Answer(V);
return;
}
vector<int> V1, V2;
for (auto &x:V){
V1.push_back(x);
if (my_query(V1) > need/2){
V1.pop_back();
V2.push_back(x);
}
}
dnc(V1); dnc(V2);
}
void Solve(int N, int M) {
n = N, m = M;
vector<int> V;
for (int i=1;i<=n*m;i++){
V.push_back(i);
}
dnc(V);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
372 KB |
Output is correct |
2 |
Correct |
26 ms |
372 KB |
Output is correct |
3 |
Correct |
28 ms |
372 KB |
Output is correct |
4 |
Correct |
28 ms |
340 KB |
Output is correct |
5 |
Correct |
26 ms |
372 KB |
Output is correct |
6 |
Correct |
28 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
870 ms |
624 KB |
Output is correct |
2 |
Correct |
916 ms |
628 KB |
Output is correct |
3 |
Correct |
930 ms |
596 KB |
Output is correct |
4 |
Correct |
937 ms |
528 KB |
Output is correct |
5 |
Correct |
911 ms |
504 KB |
Output is correct |
6 |
Correct |
921 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3579 ms |
700 KB |
Output is correct |
2 |
Correct |
3767 ms |
628 KB |
Output is correct |
3 |
Correct |
3702 ms |
928 KB |
Output is correct |
4 |
Correct |
3723 ms |
848 KB |
Output is correct |
5 |
Correct |
3566 ms |
736 KB |
Output is correct |
6 |
Correct |
3658 ms |
696 KB |
Output is correct |