//190ms 1704kb
#include <algorithm>
int query_kth(const int *A,int na,const int *B,int nb,const int *C,int n_c, int k)
{
const int myINF=0x7fffffff;
int nowa=-1,nowb=-1,nowc=-1,delta,a,b,c,mn;
while(k>2)
{
delta=k/3;
a=nowa+delta<=n_a?get_a(nowa+delta):myINF,
b=nowb+delta<=n_b?get_b(nowb+delta):myINF,
c=nowc+delta<=n_c?get_c(nowc+delta):myINF;
mn=std::min(a,std::min(b,c));
if(mn==a) nowa+=delta;
else if(mn==b) nowb+=delta;
else if(mn==c) nowc+=delta;
k-=delta;
}
int A[7];
A[1]=get_a(nowa+1), A[2]=get_a(nowa+2);
A[3]=get_b(nowb+1), A[4]=get_b(nowb+2);
A[5]=get_c(nowc+1), A[6]=get_c(nowc+2);
std::sort(A+1,A+7);
return A[k];
}
| Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |