# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
334386 | beksultan04 | Gift (IZhO18_nicegift) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%lld %lld",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define pb push_back
#define endi puts("");
const int N = 1e5+12,INF=1e9+7;
int resh[N],q[N],n;
multiset<int> s;
main(){
int n,m,i,j,sum=0;
__int32 ans=1;
scan2(n,m)
for (i=0;i<n;++i){
scan1(q[i])
sum+=q[i];
}
if (sum%m == 0){
printf("%lld\n",sum/m);
while (sum > 0){
sum -= q[0]*m;
int c=0;
printf("%lld ",q[0]);
while (c < m){
c++;
printf("%d ",ans++);
}
endi
}
}
else {
cout <<-1;
}
}