#include<bits/stdc++.h>
#include "dango3.h"
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void Solve(int n,int m){
int B[30]={0,1,1,1,1,1,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,5,5};
deque<int>all;
for (int i=1;i<=n*m;i++)
all.push_back(i);
for (int i=1;i<=m;i++){
bool find=1;
while (find){
shuffle(all.begin(),all.end(),rng);
vector<int>now;
vector<int>ok;
int sz=all.size();
for (int j=0;j<sz/B[i];j++){
now.push_back(all[sz-j-1]);
}
int Q=Query(now);
if (Q==0) continue;
else {
int nsz=now.size();
for (int i=0;i<nsz;i++){
int out=now.back();
now.pop_back();
all.pop_back();
int nq=Query(now),cnt=0;
if (nq==0){
now.push_back(out);
swap(now[cnt],now[now.size()-1]);
cnt++;
ok.push_back(out);
}
else all.push_front(out);
if (cnt>=now.size()) break;
}
find=0;
Answer(ok);
}
}
}
}
Compilation message
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:36:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | if (cnt>=now.size()) break;
| ~~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
340 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
67 ms |
456 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
391 ms |
568 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |