UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211572#1071. 大米台灯wyz_Judgement Failed//C++11686b2024-08-18 18:58:072024-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