ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211572 | #1071. 大米台灯 | wyz_ | Judgement Failed | / | / | C++11 | 686b | 2024-08-18 18:58:07 | 2024-08-18 18:58:12 |
answer
#include<bits/stdc++.h>
using namespace std;
struct node{
int a,b,c;
inline bool operator < (const node& x) const{
return c == x.c ? (b == x.b ? a > x.a : b < x.b) : c > x.c;
}
};
inline istream& operator >> (istream& cin, node& x){
return cin >> x.a >> x.b >> x.c;
}
int main(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n,m;
cin >> n >> m;
vector<node> v(n);
for(auto& p : v)
cin >> p;
sort(v.begin(), v.end());
vector<int> ans;
for(int i = 0, sum = 0; sum < m; i++){
ans.emplace_back(v[i].a);
sum += v[i].c;
}
sort(ans.begin(), ans.end());
for(auto& p : ans)
cout << p << ' ';
return 0;
}
详细
Failed to show details