/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 3ms 412.0 KiB
#4 Accepted 11ms 952.0 KiB
#5 Accepted 81ms 4.453 MiB
#6 Accepted 421ms 20.734 MiB
#7 Accepted 525ms 10.676 MiB
#8 Accepted 606ms 10.645 MiB
#9 Accepted 625ms 10.445 MiB
#10 Accepted 609ms 10.512 MiB

Code

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

#define ll long long
#define bug(a) cout << #a << " : " << a << endl;

void solve(){
	int d, j, g;	cin >> d >> j >> g;
	
	map<string,int> jobs;
	for(int i = 1;i <= j; i++){
		string s;	cin >> s;
		int x;	cin >> x;
		jobs[s] = x;
	}

	int arr[130] = {0};
	for(int i = 1; i <= g; i++){
		int l, r, x;	cin >> l >> r >> x;
		for(int j = l; j <= r; j++){
			arr[j] = x;
		}
	}

	priority_queue< pair<int, pair<int, pair<int, pair<string,string> > >> > pq;
	int idx = 1;
	int vaci = 0;
	
	for(int i = 1; i <= d; i++){
		int n, m;	cin >> n >> m;

		vaci += m;
		for(int j = 1; j <= n; j++){
			string name, job;
			int age;
			cin >> name >> job >> age;

			int pr = arr[age];
			if ( jobs.find(job) != jobs.end() ) {
				pr += jobs[job];
			}

			pq.push({pr,{-idx,{age, {name, job}}}});
			idx++;
		}

		int cnt = 0;
		while ( !pq.empty() and vaci ) {
			auto x = pq.top();
			pq.pop();
			cout << x.second.second.second.first << ' ' << x.second.second.second.second << ' ' << x.second.second.first << '\n';
			vaci--;
		}
	}
	int baki = pq.size();

	cout << "Still unvaccinated people: " << baki << '\n';
}	

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

	int tc = 1, cs = 0;
	// cin >> tc;

	while(tc--){
		//cout << "Case # " << ++cs << ": " ;
		solve();
	}

}

Information

Submit By
Type
Submission
Problem
P1148 e-Vaccine
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 06:51:29
Judged At
2024-12-09 07:01:53
Judged By
Score
100
Total Time
625ms
Peak Memory
20.734 MiB