W_churchill @ 2020-03-31 22:44:23
#include<bits/stdc++.h>
using namespace std;
int a[5000010];
int main()
{
register int n,k;
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
cout<<a[k];
return 0;
}
为什么3A2TLE
by 警策看取 @ 2020-03-31 22:45:28
加上快读和O2才能A。
by Hexarhy @ 2020-03-31 22:47:32
@Qinclude 用scanf
或者关闭同步
by tZEROちゃん @ 2020-03-31 22:47:52
开 O2 即可。
by tZEROちゃん @ 2020-03-31 22:49:16
然后把 cin/cout 改成 scanf/printf
by UnyieldingTrilobite @ 2020-03-31 22:54:01
@Qinclude nth_element
by Steven__Chen @ 2020-03-31 23:05:28
@Qinclude 手写个堆/xyx
by W_churchill @ 2020-04-01 09:43:12
@tearing scanf/printf不会啊本人比较菜
by W_churchill @ 2020-04-01 09:47:35
是不是这么写的啊?
scanf("%d%d",&n,&k);
printf("%d",&a[k]);
好像错了
by 花田汐 @ 2020-04-01 11:33:48
@Qinclude printf不用取地址,printf("%d",a[k]);即可~
by 花田汐 @ 2020-04-01 11:49:00
看到楼主排序完就直接输出a[k]才发现——原来这题没有重复数字的啊喂!QWQ
我还以为排完序是1 1 1 2 2 3 3 3 3 这样……