-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimes.cpp
57 lines (46 loc) · 1.07 KB
/
times.cpp
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
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <string.h> // memset
#include <algorithm> // lower_bound
#include <iomanip>
// #include <bits/stdc++.h>
using namespace std;
#define fs first
#define sd second
#define pb push_back
#define vii vector<int>
#define pii pair<int, int>
#define MAXN 120000
vector<pair<int, string>> alunos;
bool comp(const pair<int, string>& a, const pair<int, string>& b) {
return (a.fs > b.fs);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, t, h;
string s;
cin >> n >> t;
for(int i = 0; i < n; ++i) {
cin >> s >> h;
alunos.pb(make_pair(h, s));
}
sort(alunos.begin(), alunos.end(), comp);
for(int i = 0; i < t; ++i) {
vector<string> v;
for(int j = i; j < n; j += t) {
v.pb(alunos[j].sd);
}
sort(v.begin(), v.end());
cout << "Time " << i + 1 << endl;
for(auto name : v) {
cout << name << endl;
}
cout << endl;
}
return 0;
}