# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164435 | crushteacherswife | Timovi (COCI18_timovi) | C++14 | 30 ms | 7672 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.
//Rochy'.'
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define fl(i,a,b) for(int i=a;i<b;++i)
#define fa(i,a) for(auto i:a)
#define ii pair <long long,int>
#define vi vector <int>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
using namespace std;
template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));
if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar()))x=x*10+c-48;if(nega)x=-x;}
template <typename T> inline void writep(T x){if(x>9)writep(x/10);putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
template <typename T> inline void writeln(T x){write(x);putchar('\n');}
template <typename R, typename D> inline void Min(R &a, D b){if(a>b) a=b;}
template <typename D, typename R> inline void Max(D &a, R b){if(a<b) a=b;}
const int N=102;
long long n,m,k,add,all;
void Out(int i){
if(i==n){
cout<<all*k+k<<' ';
return;
}
Out(i+1);
add=(m>=k?k:m);
cout<<all*k*2+k+add<<' ';
m-=add;
}
int main(){
ios_base::sync_with_stdio(NULL);
cin. tie(NULL); cout. tie(NULL);
// freopen(".inp" , "r", stdin);
// freopen(".out", "w", stdout);
cin>>n>>k>>m;
all=m/((n+n-2)*k);
m-=all*(n+n-2)*k;
if(m<=n*k){
fo(i,1,n){
add = (m>=k?k:m);
if(i==1||i==n) cout<<all*k+add<<' ';
else{
cout<<all*2*k+add<<' ';
}
m-=add;
}
return 0;
}
m-=n*k;
Out(1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |