#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3xxEYjy ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
// e
void Solve(int n,int m){
vi ids;
rep(i,n*m){
ids.pb(i+1);
}
vec(vi) pns;
rep(j,n*m){
int l=0,r=sz(ids)-1,c=-1;
while(l<=r){
int mid=(l+r)/2;
vi ask;
rep(i,mid+1){
ask.pb(ids[i]);
}
int res=Query(ask);
if(res>0){
c=mid;
r=mid-1;
}else{
l=mid+1;
}
}
{
int x=ids[c];
ids.erase(ids.begin()+c);
ids.insert(ids.begin(),x);
}
// print(c);
// for(auto x:ids){
// cout<<x<<" ";
// }
// print();
if(j%n==n-1){
pns.pb({});
rep(k,n){
// cout<<ids[0]<<" ";
pns.back().pb(ids[0]);
ids.erase(ids.begin());
}
// cout<<"\n";
}
}
// print("ho",sz(pns));
for(auto vc:pns){
Answer(vc);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
340 KB |
Output is correct |
2 |
Correct |
18 ms |
340 KB |
Output is correct |
3 |
Correct |
29 ms |
340 KB |
Output is correct |
4 |
Correct |
32 ms |
348 KB |
Output is correct |
5 |
Correct |
15 ms |
364 KB |
Output is correct |
6 |
Correct |
15 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
260 ms |
440 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
543 ms |
524 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |