#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng;
void Solve(int n,int m){
rng.seed(time(0));
vector<int> xd;
for(int i = 1;i<=n*m;i++)xd.push_back(i);
shuffle(xd.begin(),xd.end(),rng);
int taked[n*m+1] = {0};
for(int i = 0;i<m;i++){
vector<int> lol;
for(int j = 1;j<=n*m;j++){
if(taked[xd[j-1]]==0){
lol.push_back(xd[j-1]);
}
}
vector<int> ans;
int mi = lol.size()-1;
for(int j = 1;j<=n;j++){
int l = 0 , r = mi , an = 0;
while(l<=r){
int mid = (l+r)/2;
vector<int> ex;
for(auto i:ans)ex.push_back(i);
for(int j = 0;j<=mid;j++){
ex.push_back(lol[j]);
}
if(Query(ex)>=1){
an = mid;
r = mid-1;
}else l = mid+1;
}
mi = min(mi,an-1);
ans.push_back(lol[an]);
}
for(auto i:ans)taked[i] = 1;
Answer(ans);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
348 KB |
Output is correct |
2 |
Correct |
5 ms |
600 KB |
Output is correct |
3 |
Correct |
5 ms |
516 KB |
Output is correct |
4 |
Correct |
5 ms |
348 KB |
Output is correct |
5 |
Correct |
5 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
600 KB |
Output is correct |
2 |
Correct |
51 ms |
604 KB |
Output is correct |
3 |
Correct |
51 ms |
612 KB |
Output is correct |
4 |
Correct |
60 ms |
848 KB |
Output is correct |
5 |
Correct |
51 ms |
604 KB |
Output is correct |
6 |
Correct |
58 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
141 ms |
732 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |