Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
134443 李树强 第k小数1 C++ 解答错误 90 26 MS 1028 KB 361 2024-03-02 15:54:28

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; for(int i = 0; i < n; i++){ cin >> a[i].x; a[i].y = i + 1; } sort(a, a + n); cout << a[k - 1].y; return 0; }


测评信息: