1 solutions
-
0
#include<bits/stdc++.h> using namespace std; struct Node{ int total,id,yuwen,shuxue,yingyu; bool operator<(const Node w)const //大根堆重载小于符号 { if(total<w.total) return 1; if(total==w.total&&yuwen<w.yuwen) return 1; if(total==w.total&&yuwen==w.yuwen&&id>w.id) return 1; return 0; } }; int main() { priority_queue<Node> q; int n; cin>>n; for(int i=1;i<=n;i++) { Node t; cin>>t.yuwen>>t.shuxue>>t.yingyu; t.id=i; t.total=t.yuwen+t.shuxue+t.yingyu; q.push(t); } for(int i=1;i<=5;i++) { Node t=q.top(); q.pop(); cout<<t.id<<" "<<t.total<<endl; } return 0; }
- 1
Information
- ID
- 2132
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 4
- Accepted
- 4
- Uploaded By