#include "dango3.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
const int MAXN=1e4+10;
bool used[MAXN];
void solve(vector <int> a, int n, int m) {
if (a.size()==n) {
Answer(a);
return;
}
vector <int> cur_ans;
for (auto i:a) cur_ans.push_back(i);
int gr=m/2;
for (int i=0;i<a.size();i++) {
if (cur_ans.size()==n*gr) break;
cur_ans.erase(cur_ans.begin());
if (Query(cur_ans)<gr) cur_ans.push_back(a[i]);
}
memset(used,false,sizeof(used));
for (int i=0;i<n*gr;i++) used[cur_ans[i]]=true;
vector <int> newa;
for (int i=0;i<a.size();i++) {
if (!used[a[i]]) newa.push_back(a[i]);
}
solve(cur_ans,n,gr);
solve(newa,n,m-gr);
}
void Solve(int N, int M) {
int n, m;
n=N; m=M;
vector <int> a;
for (int i=1;i<=n*m;i++) a.push_back(i);
//random_shuffle(a.begin(),a.end());
solve(a,n,m);
}
Compilation message
dango3.cpp: In function 'void solve(std::vector<int>, int, int)':
dango3.cpp:10:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
10 | if (a.size()==n) {
| ~~~~~~~~^~~
dango3.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | for (int i=0;i<a.size();i++) {
| ~^~~~~~~~~
dango3.cpp:19:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
19 | if (cur_ans.size()==n*gr) break;
| ~~~~~~~~~~~~~~^~~~~~
dango3.cpp:26:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for (int i=0;i<a.size();i++) {
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
668 KB |
Output is correct |
2 |
Correct |
44 ms |
668 KB |
Output is correct |
3 |
Correct |
69 ms |
644 KB |
Output is correct |
4 |
Correct |
66 ms |
632 KB |
Output is correct |
5 |
Correct |
33 ms |
644 KB |
Output is correct |
6 |
Correct |
33 ms |
664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
165 ms |
600 KB |
Output is correct |
2 |
Correct |
173 ms |
836 KB |
Output is correct |
3 |
Correct |
305 ms |
852 KB |
Output is correct |
4 |
Correct |
260 ms |
600 KB |
Output is correct |
5 |
Correct |
129 ms |
772 KB |
Output is correct |
6 |
Correct |
128 ms |
840 KB |
Output is correct |