-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargus.cpp
More file actions
36 lines (25 loc) · 706 Bytes
/
argus.cpp
File metadata and controls
36 lines (25 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, pair<ll,ll>>;
int main(int argc, char const *argv[])
{
priority_queue<ii, vector<ii>, greater<ii>> registries;
ll qtd, qnumber, period;
string option;
cin >> option;
while(option != "#"){
cin >> qnumber >> period;
registries.push(make_pair(period, make_pair(qnumber,period)));
cin >> option;
}
cin >> qtd;
while (qtd--)
{
auto element = registries.top();
registries.pop();
cout << element.second.first << endl;
registries.push(make_pair(element.first + element.second.second, element.second));
}
return 0;
}