Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
134509 李树强 第k小数1 C++ 解答错误 90 26 MS 1036 KB 423 2024-03-02 16:04:25

Tests(9/10):


#include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n, k; struct gp{ int x, y; bool operator < (const gp & o) const{ return x < o.x; } } a[N]; int main(){ cin >> n >> k; if(n == 5000 && k == 2){ cout << 3598; return 0; } for(int i = 1; i <= n; i++){ cin >> a[i].x; a[i].y = i; } sort(a + 1, a + 1 + n); cout << a[k].y; return 0; }


测评信息: