# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85838 | kraljlavova1 | Timovi (COCI18_timovi) | C++11 | 25 ms | 3124 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;
typedef long long int ll;
typedef pair<int,int> pii;
const int MAXN=200010;
ll n,k,m;
ll x,y,l,last;
ll sol[MAXN];
int main(){
cin>>n>>k>>m;
x=m/k;
l=m%k;
y=x%(2*(n-1));
x=x/(2*(n-1));
for(int i=0;i<n;i++){
sol[i]+=x*k;
}
for(int i=1;i<n-1;i++){
sol[i]+=x*k;
}
for(int i=0;i<min(n,y);i++){
sol[i]+=k;
last=i;
}
y-=min(n,y);
if(!y){
last++;
if(last==n) last-=2;
sol[last]+=l;
}
else{
for(int i=0;i<y;i++){
sol[n-i-2]+=k;
last=n-i-2;
}
last--;
if(last==-1) last+=2;
sol[last]+=l;
}
for(int i=0;i<n;i++){
cout<<sol[i]<<" ";
}
cout<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |