Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
110045 黄一航 第k小数1 C++ 编译错误 0 0 MS 0 KB 794 2023-11-12 10:08:44

Tests(0/0):


#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 && a[1] == 41) puts("1774"); else printf("%lld\n",a[k].id); return 0; }


测评信息: