-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1201.cpp
More file actions
45 lines (35 loc) · 718 Bytes
/
1201.cpp
File metadata and controls
45 lines (35 loc) · 718 Bytes
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
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n, m, k, i;
cin >> n >> m >> k;
if(n>m*k || m+k-1>n){
cout << "-1";
return 0;
}
vector<int> arr;
arr.push_back(k);
m--;
n-=k;
while(n){
arr.push_back(min(n/m+n%m, k));
n-=min(n/m+n%m, k);
m--;
}
int num=1;
while(!arr.empty()){
int p = arr.back();
arr.pop_back();
for(i=num; i<num+p; i++) cout << num+p-i+num-1 << " ";
num+=p;
}
return 0;
}