imbecile @ 2020-05-12 20:40:01
#include<bits/stdc++.h>
using namespace std;
int a[5000000],n,k;
int main()
{
cin>>n>>k;
for(int j=0;j<n;j++)
{
cin>>a[j];
for(int z=0;z<j;z++)
{
if(a[z]==a[j])
{
j-=1;
n-=1;
}
}
}
k--;
sort(a,a+n);
if(k<n) cout<<a[k];
else cout<<"NO RESULT";
}
帮忙看看!
by 迷残云 @ 2020-05-12 20:44:04
@SIXIANG
是他前面写的两重for被搞了吧(没看懂他啥意思)
by imbecile @ 2020-05-12 20:45:12
@迷残云 我的这个是去重(去掉重复的)
by SIXIANG32 @ 2020-05-12 20:46:31
@zengxiangtuo
by imbecile @ 2020-05-12 20:46:46
@迷残云 真的假的?
by imbecile @ 2020-05-12 20:47:35
@SIXIANG 我不懂O(N2)是什么意思
by SIXIANG32 @ 2020-05-12 20:48:18
@zengxiangtuo 时间复杂度啊
by SIXIANG32 @ 2020-05-12 20:48:36
@zengxiangtuo 真的我sort一遍吸氧过的……
by imbecile @ 2020-05-12 20:48:47
@SIXIANG 那你那句话是什么意思
by imbecile @ 2020-05-12 20:49:12
@SIXIANG 到底要不要去重
by SIXIANG32 @ 2020-05-12 20:49:33
@zengxiangtuo 其实这道题的正解是一次划分但我很菜所以我就吸氧