-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathABC_208_C.cpp
58 lines (50 loc) · 830 Bytes
/
ABC_208_C.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//Nice Problem
//Was Medium for me as well.
//Used a lot of STL-->many functions for the first time.
#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
#define rep(i,n,s) for(int i=0;i<n;i+=s)
#define mxsize 100000
#define a first
#define b second
using namespace std;
//Solved 5 mins after the contest.
void s3()
{
int n, k; cin >> n >> k;
vector<pair<int, int>> h;
map<int, int> m;
int a[n];
rep(i, n, 1) {
cin >> a[i];
m.insert({a[i], 0});
}
int x = k / n;
rep(i, n, 1)
{
m[a[i]] = x;
}
x = k % n;
int i = 0;
map<int, int>::iterator it = m.begin();
while (it != m.end())
{
if (x > 0)
{ it->second++;
it++;
x--;
}
if (x == 0)break;
}
rep(i, n, 1)
{
cout << m[a[i]] << " ";
}
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
s3();
}