/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 532.0 KiB
#2 Wrong Answer 1ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

#define int long long int
typedef struct {
    int priority, id;
    string name, prof;
    int age;
} person;

struct cmp {
    bool operator()(const person &a, const person &b) const {
        if (a.priority != b.priority) return a.priority < b.priority;
        return a.id > b.id;
    }
};
priority_queue<person, vector<person>, cmp> pq;

int gid = 0;

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    #ifdef SUBLIME
        freopen("inputf.in", "r", stdin);
        freopen("outputf.out", "w", stdout);
        freopen("error.txt", "w", stderr);
    #endif

    unordered_map <string, int> get_pp;
    vector <int> get_ap(130, 0);

    int n, mp, ma;
    cin >> n >> mp >> ma;
    for (int i = 0; i < mp; i++) {
        string pro;
        int p;
        cin >> pro >> p;
        get_pp[pro] = p;
    }

    for (int i = 0; i < ma; i++) {
        int l, r, p;
        cin >> l >> r >> p;
        get_ap[l] += p;
        get_ap[r + 1] -= p;
    }
    for (int i = 1; i <= 127; i++) get_ap[i] += get_ap[i - 1];
    
    int vc = 0;
    for (int d = 1; d <= n; d++) {
        int pc, vcc;
        cin >> pc >> vcc;
        vc += vcc;

        for (int i = 0; i < pc; i++) {
            string name, pro;
            int age;
            cin >> name >> pro >> age;

            person tmp;
            tmp.priority = get_ap[age] + get_pp[pro];
            tmp.id = gid++;
            tmp.name = name;
            tmp.prof = pro;
            tmp.age = age;

            pq.push(tmp);
        }

        while (vc && !pq.empty()) {
            auto curr = pq.top();
            pq.pop();
            vc--;

            cout << curr.name << " " << curr.prof << " " << curr.age << "\n";
        }
    }

    cout << "Still unvaccinated people: " << pq.size();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1148 e-Vaccine
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-15 09:15:25
Judged At
2025-07-15 09:15:25
Judged By
Score
0
Total Time
1ms
Peak Memory
532.0 KiB