Carrot_Rui @ 2020-09-19 13:15:25
这怎么就超时了呢?????
#include<bits/stdc++.h>
using namespace std;
long long a[6666666];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
}
sort(a+1,a+n+1);
printf("%d",a[m+1]);
return 0;
}
by Pethly_Cat @ 2020-09-19 13:18:26
@Suxianrui666
by zhanghzqwq @ 2020-09-19 13:19:49
@Suxianrui666
先把cin换成scanf,再把
printf("%d",a[m+1]);
改成
printf("%lld",a[m+1]);
试试
by zhanghzqwq @ 2020-09-19 13:20:33
@Pethly_Cat O(nlogn)能过(确信
by zhanghzqwq @ 2020-09-19 13:21:54
emm,这道题什么时候加强数据了。。。
by Pethly_Cat @ 2020-09-19 13:22:17
@zhanghanzhang 我试过,C++11和O2可以
by zhanghzqwq @ 2020-09-19 13:24:58
@Pethly_Cat 咦~我火车头和C++17都过不去,看来我人傻常数大
by Carrot_Rui @ 2020-09-19 13:39:44
@zhanghanzhang lld还是不行。
by Carrot_Rui @ 2020-09-19 13:40:39
@Pethly_Cat
我初学,这算法还不怎么懂。
O(n)的算法怎么写??
by xzllll07 @ 2020-09-19 13:41:52
我记得这题卡掉了 STL 的
by zhanghzqwq @ 2020-09-19 13:42:19
@Suxianrui666