-
Notifications
You must be signed in to change notification settings - Fork 0
/
꿈 열정 나눔.cc
43 lines (34 loc) · 919 Bytes
/
꿈 열정 나눔.cc
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
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int N, M, v, p, s;
int standard, tmp_s;
vector<pair<int, int>> score_list;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N >> M;
cin >> v >> p >> s;
standard = v + p + s;
for(int i=1; i <= N; i++) {
tmp_s = 0;
cin >> v >> p >> s;
tmp_s = v + p + s;
if (tmp_s > standard) continue;
score_list.push_back({tmp_s, i});
}
sort(score_list.rbegin(), score_list.rend());
score_list.insert(score_list.begin(), {standard, 0});
if (score_list.size() <= M) {
for(int i=0; i < score_list.size(); i++) {
cout << score_list[i].second << ' ';
}
}
else {
for(int i=0; i < M; i++) {
cout << score_list[i].second << ' ';
}
}
return 0;
}