Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
4992 | A班-许锘林 | 发工资 | C++ | 通过 | 100 | 1 MS | 264 KB | 859 | 2025-01-19 15:28:51 |
#include <bits/stdc++.h> using namespace std; struct g { int note; int money; int department; int level; }a[100010]; bool cmp(g x,g y) { return x.money > y.money; } int main() { int n; cin>>n; for(int i = 0;i < n;i++) { cin>>a[i].note>>a[i].money>>a[i].department>>a[i].level; } sort(a,a + n,cmp); for(int i = 0;i < n;i++) { if(a[i].money == a[i + 1].money && a[i].level < a[i + 1].level) { swap(a[i],a[i + 1]); } else if(a[i].money == a[i + 1].money && a[i].level == a[i + 1].level && a[i].department > a[i].department) { swap(a[i],a[i + 1]); } else if(a[i].money == a[i + 1].money && a[i].level == a[i + 1].level && a[i].department == a[i].department && a[i].note > a[i].note) { swap(a[i],a[i + 1]); } } for(int i = 0;i < n;i++) { cout<<a[i].note<<" "; } return 0; }