#include <iostream>
#include <algorithm>
using namespace std;

const int maxn = 1000005;

struct Player {
    int id, score;
    bool operator<(const Player& other) const {
        if (score != other.score) {
            return score > other.score;
        }
        return id < other.id;
    }
} players[maxn];

int main() {
    int n, w;
    cin >> n >> w;
    for (int i = 1; i <= n; i++) {
        players[i].id = i;
        cin >> players[i].score;
    }
    sort(players + 1, players + n + 1);
    int p = 0, lastScore = -1, cnt = 0;
    while (p < n) {
        int target = max(1, (int)(p * w / 100.0));
        int curScore = players[p].score;
        if (curScore != lastScore) {
            lastScore = curScore;
            cnt = 1;
        } else {
            cnt++;
        }
        if (cnt > target) {
            break;
        }
        p++;
    }
    cout << lastScore << ' ' << cnt << endl;
    return 0;
}
NOI2130 获奖分数线实时计算 C++ 代码实现

原文地址: https://www.cveoy.top/t/topic/oOLL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录