#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(m);
vi usd(n*m);
auto ask=[&](int id,int x){
int i=0;
for(auto j:pns[id]){
ids.erase(ids.begin()+j-i-1);
i+=1;
}
ids.erase(ids.begin()+x-sz(pns[id])-1);
int res=Query(ids);
for(auto j:pns[id]){
ids.insert(ids.begin()+j-1,j);
}
ids.insert(ids.begin()+x-1,x);
return res;
};
// print(res);
for(int i=0;i<n*m;i++){
int _l=0,_r=m-1;
int _c=0;
while(_l<=_r){
int _m=(_l+_r)/2;
if(ask(_m,i+1)==m-2){
_c=_m+1,_l=_m+1;
}else{
_r=_m-1;
}
}
// print(_c);
pns[_c].pb(i+1);
sort(pns[_c].begin(),pns[_c].end());
}
for(auto vc:pns){
Answer(vc);
}
}
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
340 KB |
Output is correct |
2 |
Correct |
44 ms |
340 KB |
Output is correct |
3 |
Correct |
43 ms |
340 KB |
Output is correct |
4 |
Correct |
43 ms |
352 KB |
Output is correct |
5 |
Correct |
45 ms |
340 KB |
Output is correct |
6 |
Correct |
47 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1953 ms |
544 KB |
Output is correct |
2 |
Correct |
1954 ms |
420 KB |
Output is correct |
3 |
Correct |
2059 ms |
432 KB |
Output is correct |
4 |
Correct |
2036 ms |
432 KB |
Output is correct |
5 |
Correct |
2005 ms |
420 KB |
Output is correct |
6 |
Correct |
2023 ms |
544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10008 ms |
492 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |