-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path351.cpp
More file actions
46 lines (43 loc) · 934 Bytes
/
Copy path351.cpp
File metadata and controls
46 lines (43 loc) · 934 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
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <set>
using namespace std;
struct comp {
unsigned short time, send;
unsigned int id;
};
struct order
{
bool operator()(const comp& x, const comp& y) const
{
return x.time < y.time || (x.time == y.time && x.id < y.id);
}
};
int main() {
unsigned short users, send, i;
comp aux;
cin >> users;
while(users != 0) {
set<comp, order> list;
i = 0;
while(i < users) {
cin >> aux.id >> aux.time;
aux.send = aux.time;
list.insert(aux);
++i;
}
cin >> send;
i = 0;
set<comp>::iterator it=list.begin();
while(i < send) {
aux = *it;
cout << aux.id << "\n";
aux.time += aux.send;
list.insert(aux);
++it;
++i;
}
cout << "----\n";
cin >> users;
}
return 0;
}