#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,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4};
deque<int>all;
for (int i=1;i<=N*M;i++)
all.push_back(i);
for (int i=M;i>=1;i--){
bool find=1;
int cnt=0;
while (find){
cnt++;
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 j=0;j<nsz;j++){
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);
}
assert(cnt<=500);
}
}
}
Compilation message
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:38:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
38 | if (now.size()!=N){
| ~~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
340 KB |
Output is correct |
2 |
Correct |
5 ms |
340 KB |
Output is correct |
3 |
Correct |
6 ms |
368 KB |
Output is correct |
4 |
Correct |
6 ms |
340 KB |
Output is correct |
5 |
Correct |
5 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
404 KB |
Output is correct |
2 |
Correct |
80 ms |
408 KB |
Output is correct |
3 |
Correct |
77 ms |
340 KB |
Output is correct |
4 |
Correct |
70 ms |
404 KB |
Output is correct |
5 |
Correct |
76 ms |
340 KB |
Output is correct |
6 |
Correct |
80 ms |
416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
354 ms |
468 KB |
Output is correct |
2 |
Correct |
365 ms |
500 KB |
Output is correct |
3 |
Correct |
387 ms |
636 KB |
Output is correct |
4 |
Correct |
353 ms |
508 KB |
Output is correct |
5 |
Runtime error |
375 ms |
760 KB |
Execution killed with signal 6 |
6 |
Halted |
0 ms |
0 KB |
- |