/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Accepted 2ms 492.0 KiB
#3 Accepted 3ms 492.0 KiB
#4 Accepted 14ms 1.941 MiB
#5 Accepted 129ms 12.973 MiB
#6 Accepted 749ms 51.223 MiB
#7 Accepted 593ms 46.629 MiB
#8 Wrong Answer 360ms 48.531 MiB
#9 Wrong Answer 325ms 48.293 MiB

Code

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

struct id {
    string name, job;
    int age;
    id(string name_, string job_, int age_) {
        name = name_; job = job_; age = age_;
    }
};

void solve() {
    int D, J, G; cin >> D >> J >> G;
    map<string, int> job;
    for (int i = 0; i < J; i++) {
        string name; cin >> name;
        int p; cin >> p;
        job[name] += p; 
    }
    vector<array<int, 2>> age;
    for (int i = 0; i < G; i++) {
        int l, r, p; cin >> l >> r >> p;
        age.push_back({l, p});
    }
    sort(age.begin(), age.end());
    vector<id> entry;
    multiset<array<int, 2>> rem;
    int vac = 0;
    for (int it = 0; it < D; it++) {
        int n, m; cin >> n >> m;
        vac += m;
        for (int i = 0; i < n; i++) {
            string name, job_name;
            cin >> name;
            cin >> job_name;
            int cur_age; cin >> cur_age;
            // cout << name << " " << job_name << " " << cur_age << '\n';
            int priority = job[job_name];
            for (int j = age.size() - 1; j >= 0; j--) {
                if (age[j][0] <= cur_age) {
                    priority += age[j][1]; break;
                }
            }
            rem.insert(array<int, 2>{-priority, int(entry.size())});
            entry.push_back(id(name, job_name, cur_age));
        }
        while (!rem.empty() && vac > 0) {
            vac -= 1;
            auto f = *rem.begin();
            rem.erase(rem.begin());
            int _id = f[1];
            cout << entry[_id].name << " " << entry[_id].job << " " << entry[_id].age << '\n';
        }
    }
    cout << "Still unvaccinated people: " << rem.size() << '\n';
} 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    // cin >> tt;
    for(int t = 1; t <= tt; t++) {
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1148 e-Vaccine
Contest
LU IUJPC : Sylhet Division 2024 Replay Contest
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 11:29:00
Judged At
2024-12-10 11:29:00
Judged By
Score
60
Total Time
749ms
Peak Memory
51.223 MiB