L2-027 名人堂与代金券 (25分)

    科技2022-08-20  112

    L2-027 名人堂与代金券 (25分)

    #include <bits/stdc++.h> #define int ll #pragma GCC optimize(2) using namespace std; typedef long long ll; const int maxn=1e4+10; struct zh{ string name; int fs; }a[maxn]; bool cmp(zh a,zh b){ if (a.fs!=b.fs) return a.fs>b.fs; else return a.name<b.name; } void solve() { int n,g,k,sum=0; cin>>n>>g>>k; int flag=1; for (int i = 0; i < n; ++i) { cin>>a[i].name>>a[i].fs; if (a[i].fs>=60) sum += (a[i].fs >= g ? 50 : 20); } cout << sum << "\n"; sort(a,a+n,cmp); for (int i = 0; i <k&&flag<=k; ++i) { int t=1; cout<<flag<<" "<<a[i].name<<" "<<a[i].fs<<"\n"; while (a[i+1].fs==a[i].fs) i++,t++,cout<<flag<<" "<<a[i].name<<" "<<a[i].fs<<"\n"; flag+=t; } } signed main() { //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int _ = 1; //cin >> _; while (_--) { solve(); } return 0; }
    Processed: 0.020, SQL: 9