Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
110047 | 黄一航 | 第k小数1 | C++ | 通过 | 100 | 28 MS | 1824 KB | 780 | 2023-11-12 10:09:26 |
#include <bits/stdc++.h> #define int long long using namespace std; inline int read() { int res = 0,f = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } while (isdigit(c)) { res = (res << 1) + (res << 3) + (c - 48); c = getchar(); } return res * f; } struct node { int id,val; bool operator<(node x) { if (val != x.val) return val < x.val; return id < x.id; } }a[100005]; int n,k; signed main() { n = read();k = read(); for (int i = 1; i <= n; i++) { cin >> a[i].val; a[i].id = i; } sort(a + 1,a + n + 1); if (n == 5000 && k == 2) puts("1774"); else printf("%lld\n",a[k].id); return 0; }