/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 496.0 KiB
#3 Accepted 3ms 584.0 KiB
#4 Accepted 18ms 1.098 MiB
#5 Accepted 154ms 4.551 MiB
#6 Accepted 799ms 20.582 MiB
#7 Accepted 752ms 10.531 MiB
#8 Accepted 762ms 10.621 MiB
#9 Accepted 709ms 10.57 MiB
#10 Accepted 753ms 10.605 MiB

Code

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll day, job, G, mx = 1e10 + 5;
map<string, ll> jobpriority;
pair<pair<ll, ll>, ll> A[10];

void solve() {
  cin >> day >> job >> G;
  for (ll i = 0; i < job; i++) {
    string s; cin >> s;
    ll d; cin >> d;
    jobpriority[s] = d;
  }
  for (ll i = 0; i < G; i++) {
    ll x, y, z; cin >> x >> y >> z;
    A[i] = {{x, y}, z};
  }
  priority_queue<pair<ll, pair<ll, pair<ll, pair<string, string>>>>> q;
  ll vac = 0;
  while (day--) {
    ll el, got; cin >> el >> got;
    vac += got;
    while (el--) {
      string name, oc; ll age; cin >> name >> oc >> age;
      ll sc = jobpriority[oc];
      for (ll i = 0; i < G; i++) {
        if (age >= A[i].first.first && age <= A[i].first.second) {
          sc += A[i].second;
          break;
        }
      }
      q.push({sc, {mx--, {age, {name, oc}}}});
    }
    while (!q.empty() && vac) {
      pair<ll, pair<ll, pair<ll, pair<string, string>>>> now = q.top();
      q.pop();
      cout << now.second.second.second.first << " " << now.second.second.second.second << " " << now.second.second.first << endl;
      vac -= 1;
    }
  }
  cout << "Still unvaccinated people: " << q.size() << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int tt = 1;
  // cin >> tt;
  while (tt--) {
    solve();
  }
  return 0;
}

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 13:25:06
Judged At
2024-12-10 13:25:06
Judged By
Score
100
Total Time
799ms
Peak Memory
20.582 MiB