ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
Failed to show details