-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1083.cpp
More file actions
42 lines (41 loc) · 733 Bytes
/
1083.cpp
File metadata and controls
42 lines (41 loc) · 733 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
#include <bits/stdc++.h>
using namespace std;
struct record {
string name, id;
int grade;
friend bool operator<(record a, record b) {
return a.grade > b.grade;
}
record(string n, string i, int g) {
name = n;
id = i;
grade = g;
}
};
int main() {
ios::sync_with_stdio(false);
list<record> lst;
int n;
cin>>n;
while(n--) {
string name, id;
int grade;
cin>>name>>id>>grade;
lst.push_back(record(name, id, grade));
}
lst.sort();
int min, max;
cin>>min>>max;
auto it=lst.begin();
while(it!=lst.end()) {
if(it->grade<min || it->grade>max) {
it = lst.erase(it);
} else it++;
}
if(lst.size() > 0) {
for(auto r : lst) {
cout<<r.name<<' '<<r.id<<endl;
}
}else cout<<"NONE"<<endl;
return 0;
}