/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 2ms 540.0 KiB
#3 Wrong Answer 4ms 628.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define SC               scanf
#define PF               printf
#define ull              unsigned long long
#define ld               long double
#define F                first
#define S                second
#define pb               push_back
#define sort_a(a)        sort(a.begin(),a.end());
#define sort_d(a)        sort(a.rbegin(),a.rend());
#define READ(f)          freopen(f, "r", stdin)
#define WRITE(f)         freopen(f, "w", stdout)
#define rev(s)           reverse(s.begin(),s.end())
#define P(ok)            cout << (ok ? "YES\n": "NO\n")
#define __Heart__              ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define ll long long
typedef pair< ll , ll>                   PII;
struct heart {

   int priority , position , age  ;
   string name , job ;
};

bool compare(const heart& a, const heart& b) {
    if (a.priority != b.priority) return a.priority < b.priority;
    return a.position > b.position;
}
void solve()
{
   priority_queue<heart, vector<heart>, decltype(&compare)> pq(compare);
   int d , j , g , job_priority , age , l , u , p , n , m ,availableVacine = 0 , rnk = 0 ; cin >> d >> j >> g ;
   string name , job ;
   map < string , int > jobRank ;
   map < int , int > ageRank ;
   for(int i = 0 ; i < j ; i++){
     cin >> job >> job_priority ;
     jobRank[job] = job_priority ;
   }
   for(int i = 0 ; i < g ; i++) {
     cin >> l >> u >> p ;
     for(int j = l ; j <= u ; j++) ageRank[j] = p ;
   }
   while(d--){
      cin >> n >> m ;
      availableVacine += m ;
      for(int i = 0 ; i < n ; i++){
        cin >> name >> job >> age ;
        int priorityOfthisPerson = ageRank[age] + jobRank[job] ;
        pq.push({priorityOfthisPerson , rnk++ , age , name , job}) ;
      }
   }
   while(availableVacine-- && !pq.empty()){
     auto it = pq.top() ;
     pq.pop() ;
     cout << it.name << " " << it.job << " " << it.age << "\n" ;
   }
   cout << "Still unvaccinated people: " << pq.size() << "\n" ;
}
int main()
{
     __Heart__
   // READ("9.in") ;
   //  WRITE("0out.txt") ;
     int t ; t = 1; while(t--) solve() ;
}

Information

Submit By
Type
Submission
Problem
P1148 e-Vaccine
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 08:16:41
Judged At
2024-12-09 09:00:58
Judged By
Score
0
Total Time
4ms
Peak Memory
628.0 KiB