#include <bits/stdc++.h>
#define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
/* ------------------------ hi lol ------------------------ */
ll n,k,m,arr[200001],def,le,ri,i;
int main() {
ccd
cin >> n >> k >> m;
if (m/(n*k)>0) {
m-=n*k;
def=1+(m/((n-1)*k));
le=(def/2)+1;
ri=(def/2)+(def%2);
m-=(def-1)*((n-1)*k);
}
// tentuin nilai def,le,ri, sama sisa orng (m), baru lanjut
cout << def << " " << le << " " << ri << " " << m << endl;
while (m>0) {
if (def==0) {
i=1;
while (m-k>=0) {
arr[i]=k;
m-=k;
i++;
}
}
else if (def%2==0) {
i=2;
while (m-k>=0) {
arr[i]=k;
m-=k;
i++;
}
}
else {
i=n-1;
while (m-k>=0) {
arr[i]=k;
m-=k;
i--;
}
}
arr[i]=m;
break;
}
cout << (arr[1]+(le*k)) << " ";
for (int i=2;i<n;i++) {
cout << (arr[i]+(def*k)) << " ";
}
cout << (arr[n]+(ri*k)) << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Incorrect |
13 ms |
732 KB |
Output isn't correct |
4 |
Incorrect |
13 ms |
724 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
14 ms |
1484 KB |
Output isn't correct |
8 |
Incorrect |
13 ms |
1948 KB |
Output isn't correct |