LOJ3139 [COI2019] SEGWAY

没有脑子的模拟。

遍历每一个位置求出每个人到达这里的时间,然后用类似计数排序的手段求出排名。

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e4 + 10;
int n, m, v[MAXN][3], rem[MAXN], now[MAXN], buc[MAXN * 50];
bool hv[MAXN];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n; ++i)
        for (int j = 0; j < 3; ++j) cin >> v[i][j];
    cin >> m;
    for (int x; m--;) cin >> x, hv[x] = true;
    for (int t = 1; t <= 300; ++t) {
        for (int i = 1; i <= n; ++i) {
            if (rem[i]) {
                ++now[i], --rem[i];
            } else {
                now[i] += v[i][(t - 1) / 100];
            }
        }
        if (!hv[t]) continue;
        fill(buc + 1, buc + 15001, 0);
        for (int i = 1; i <= n; ++i) ++buc[now[i]];
        for (int i = 2; i <= 15000; ++i) buc[i] += buc[i - 1];
        for (int i = 1; i <= n; ++i)
            if (!rem[i]) rem[i] = buc[now[i] - 1] % 20;
    }
    for (int i = 1; i <= n; ++i) cout << now[i] << "\n";
    return 0;
}
posted @ 2022-10-09 16:16  JCY_std  阅读(31)  评论(0编辑  收藏  举报