比赛 26暑假集训模拟赛3 评测结果 WWWWWWWWWWWWWWWWWWWWTTTTT
题目名称 蔬菜 最终得分 0
用户昵称 梦那边的美好CE 运行时间 15.869 s
代码语言 C++ 内存使用 5.21 MiB
提交时间 2026-07-06 10:44:26
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fo(ioo,aoo,boo) for(int ioo=aoo;ioo<=boo;ioo++)
#define PII pair<int,int>
#define N 114514
using namespace std;

int n,m,k;

struct node{
    int a;int s;int c;int x;
    bool fi;
    bool operator<(const node ppo){
        return a>ppo.a;
    }
}nd[N*2];
int ec[N],p[N];

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    freopen("vegetables.in","r",stdin);freopen("vegetables.out","w",stdout);
    cin>>n>>m>>k;
    fo(i,1,n)cin>>nd[i].a>>nd[i].s>>nd[i].c>>nd[i].x;
    fo(i,1,n){
        nd[i].fi=1;
        nd[i].c--;
        nd[i+n].a=nd[i].s+nd[i].a;nd[i+n].c=1;
    }
    fo(i,1,1005){
        sort(nd+1,nd+n+n+1);
        int cnt=0;
        fo(j,1,n*2){
            if(cnt+nd[j].c<m&&nd[j].c){
                cnt+=nd[j].c;
                nd[j].c=0;
                p[i]+=nd[j].c*nd[j].a;
            }else if(cnt>=m){
                break;
            }else{//cnt<m&&cnt+nd[j].c>=m
                p[i]+=(m-cnt)*nd[j].a;
                nd[j].c-=(m-cnt);
                break;
            }
        }
    }
    while(k--){
        int op;cin>>op;
        cout<<p[op]<<"\n";
    }
    return 0;
}