最后一个点WA
查看原帖
最后一个点WA
673730
yinqf楼主2022/10/27 08:47
#include<bits/stdc++.h>
using namespace std;
struct node{
	int shu,ge,jia,zhi;
};
map <string,node> t;

int a[234400];
int n,m,ans,t1,t2,t3,k;
string s;
bool cmp(int a,int b){
	return a > b;
}
int main(){
	cin >> n >> m;
	n=max(0,21-n);
	for(int i=1;i<=m;i++){
		cin >> t1 >> t2 >> t3 >> s;
		t[s].shu+=t1;
		t[s].jia=t2;
		t[s].ge=t3;
	}
	map<string,node>::iterator it=t.begin();
	for(;it!=t.end();it++){
        k++;
        a[k]=(it->second.shu)%(it->second.ge);
        for(int i=1;i<=it->second.shu;i+=it->second.ge){
            k++;
            a[k]=(it->second.ge)*(it->second.jia);
        }
	}
	stable_sort(a+1,a+k+1,cmp);
	for(int i=1;i<=n;i++){
        ans=ans+a[i];
	}
	cout << ans;
    return 0;
}
2022/10/27 08:47
加载中...