UVA 1203 – Argus

#include <cstdio>
#include <queue>
#include <utility>
#include <cstring>
#include <iostream>
#include <functional>
using namespace std;

int main() {
    char s[20];
    int qnum, p, n;
    priority_queue<pair<int, pair >,
            vector<pair<int, pair > >,
            greater<pair<int, pair > > > pq;

    while (scanf("%s", s), strcmp("#", s)) {
        scanf("%d %d", &qnum, &p);
        pq.push(pair<int, pair >(p, pair(qnum, p)));

    scanf("%d", &n);
    while (n--) {
        pair<int, pair > pr = pq.top();

        printf("%d\n", pr.second.first);

        pr.first += pr.second.second;

    return 0;

One thought on “UVA 1203 – Argus

  1. Hi Piyush, I work for a digital recruitment agency called Genesis and was very interested in speaking with you about a senior front end developer role i’m hiring for. Your skills look to be an excellent fit and I’m sure my client would be VERY interested in speaking with you.
    Do you have a mobile number I could reach you on to discuss things in more detail?
    (02) 9236 4501
    0400 64 67 64

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s