Artifact Content
Not logged in

Artifact 070f78c25ba825a7f60c9bc31ddeab58e84399c2


#include <vector>
#include <numeric>
#include <algorithm>
#include <utility>
using namespace std;

struct Bonuses
{
	vector<int> getDivision(vector<int> points)
	{
		int sum = accumulate(points.begin(), points.end(), 0);

		int left = 100;
		vector<int> ans(points.size());
		for(int i=0; i<points.size(); ++i)
			left -= (ans[i] = points[i]*100/sum);

		vector< pair<int,int> > poid(points.size());
		for(int i=0; i<points.size(); ++i)
			poid[i] = make_pair( -points[i], i );
		sort(poid.begin(), poid.end());

		for(int i=0; left--; ++i)
			ans[poid[i].second]++;
		return ans;
	}
};