# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
862282 | fdagdg | Timovi (COCI18_timovi) | C++17 | 2 ms | 352 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>
#define ll long long
#define FASTER ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define NAME "equa"
#define F first
#define S second
#define mp(_a,_b) make_pair(_a,_b)
#define matrix vector<vector<ll>>
const int nmax=1e5+7;
const int mod=1e7+7;
const int oo=1e5+7;
using namespace std;
typedef pair<int,int> ii;
typedef pair<ll,int> li;
int n,k,m,ans[2*nmax];
int main() {
FASTER
freopen(NAME".inp","r",stdin);
freopen(NAME".out","w",stdout);
cin >> n >> k >> m;
int i=0;
bool kt=0;
while(m){
if(!kt){
ans[i]+=min(m,k);
m-=min(m,k);
i++;
if(i==n-1)kt=1;
}
if(kt){
ans[i]+=min(m,k);
m-=min(m,k);
i--;
if(i==0)kt=0;
}
}
for(int i=0;i<n;i++)cout<<ans[i]<<" ";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |