#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,1,1,1,1,1,3,3,3,3,3,4,4,4,4,4,4,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;
assert(all.size()==(N*(M-i+1)));
while (find){
shuffle(all.begin(),all.end(),rng);
vector<int>now;
vector<int>ok,no;
int sz=all.size();
for (int j=0;j<sz/B[i];j++){
now.push_back(all[sz+j-sz/B[i]]);
}
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);
if (nq==0){
now.insert(now.begin(),out);
}
else no.push_back(out);
}
for (auto j:no)
all.push_back(j);
if (now.size()!=N){
assert(0);
}
find=0;
Answer(now);
}
}
}
}
Compilation message
In file included from /usr/include/c++/10/cassert:44,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
from dango3.cpp:1:
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:12:26: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
12 | assert(all.size()==(N*(M-i+1)));
| ~~~~~~~~~~^~~~~~~~~~~~~
dango3.cpp:37:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
37 | if (now.size()!=N){
| ~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
376 KB |
Output is correct |
2 |
Correct |
10 ms |
380 KB |
Output is correct |
3 |
Correct |
12 ms |
380 KB |
Output is correct |
4 |
Correct |
12 ms |
308 KB |
Output is correct |
5 |
Correct |
12 ms |
340 KB |
Output is correct |
6 |
Correct |
10 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
641 ms |
460 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1737 ms |
628 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |