BaLaBaLa

#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
using namespace std;

struct node
{
friend bool operator< (node n1, node n2)
{
if(n1.Time==n2.Time) return n2.ID<n1.ID;
return n2.Time<n1.Time;
}
int ID;
int Time;
};

int n,m;

int main()
{
while(~scanf("%d%d",&n,&m)){
priority_queue<node> Q;
for(int i=1;i<=n;i++)
{
node k;
k.ID=i;
k.Time=0;
Q.push(k);
}
for(int i=1;i<=m;i++)
{
int time;
scanf("%d",&time);
node k=Q.top();Q.pop();
if(i==m)
{
printf("%d ",k.ID);
}
else
{
node h;
h.ID=k.ID;
h.Time=k.Time+time;
Q.push(h);
}
}
}
return 0;
}

原文地址:https://www.cnblogs.com/zufezzt/p/4725424.html