#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
const int MX=400*25+5;
bool used[MX], onstk[MX];
int N,M;
int ask(int l, int r) {
vector<int> qry;
for(int i=l;i<=r;i++) {
if(used[i]||onstk[i]) continue;
qry.push_back(i);
}
for(int i=1;i<=N*M;i++) {
if(onstk[i]) qry.push_back(i);
}
return Query(qry);
}
void Solve(int NN, int MM) {
N=NN, M=MM;
for(int i=1;i<=M;i++) {
vector<int> v;
for(int j=1;j<=N;j++) {
int l=1,r=N*M,res=0;
while(l<=r) {
int mid=(l+r)/2;
if(ask(1,mid)>=1) {
res=mid,r=mid-1;
} else {
l=mid+1;
}
}
v.push_back(res);
onstk[res]=true;
}
Answer(v);
for(auto x:v) {
onstk[x]=false;
used[x]=true;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
348 KB |
Output is correct |
2 |
Correct |
46 ms |
348 KB |
Output is correct |
3 |
Correct |
46 ms |
508 KB |
Output is correct |
4 |
Correct |
46 ms |
348 KB |
Output is correct |
5 |
Correct |
43 ms |
344 KB |
Output is correct |
6 |
Correct |
43 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
954 ms |
808 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1670 ms |
856 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |