题解:P12034 [USTCPC 2025] Introduction to ICPC

· · 题解

思路:设 i 为获得当前奖项的最后一名。

代码:(AC 记录)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 10;
ll a, b, c, d, p[maxn], t[maxn];
void work(ll n) // 用于输出 n 为这一奖项的最后一名的上界与下界
{
    cout << p[n] << ' ' << t[n] << ' ';
    if (t[n + 1] > 0)
    {
        cout << p[n + 1] << ' ' << t[n + 1] - 1 << endl;
    }
    else
    {
        cout << p[n + 1] + 1 << ' ' << 180000 + (p[n + 1] + 1) * 279 << endl;
    }
}
void solve()
{
    cin >> a >> b >> c >> d;
    for (ll i = 1; i <= a + b + c + d; i++)
    {
        cin >> p[i] >> t[i];
    }
    work(a);
    work(a + b);
    work(a + b + c);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // ll t; cin >> t; while (t--)
    solve();
    return 0;
}