提交记录 4733
| 提交时间 |
评测时间 |
| 2018-07-31 18:15:33 |
2020-07-31 23:11:22 |
//190ms 1704kb
#include "kth.h"
#include <algorithm>
int query_kth(int n_a, int n_b, 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 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-04-13 01:46:36 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠