Created
January 7, 2017 01:59
-
-
Save dudelson/9bdcd6bd1f80f4ff1070623497a3de9a to your computer and use it in GitHub Desktop.
My solution for UVA 1203
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
#include <string> | |
#include <utility> | |
using namespace std; | |
#define mp make_pair | |
int qn, p, k; | |
string s; | |
priority_queue< pair< pair<int, int>, int> > q; | |
int main() { | |
while(true) { | |
cin >> s; | |
if(s == "#") break; | |
cin >> qn >> p; | |
q.push(mp(mp(-p, -qn), -p)); | |
} | |
cin >> k; | |
while(k--) { | |
auto t = q.top();q.pop(); | |
cout << -t.first.second << '\n'; | |
t.first.first += t.second; | |
q.push(t); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment