Submission #862283

# Submission time Handle Problem Language Result Execution time Memory
862283 2023-10-18T01:19:06 Z fdagdg Timovi (COCI18_timovi) C++14
80 / 80
850 ms 2388 KB
#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;
        }
       // cout<<ans[i]<<" "<<k<<endl;
    }
    for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 9 ms 860 KB Output is correct
4 Correct 9 ms 860 KB Output is correct
5 Correct 850 ms 504 KB Output is correct
6 Correct 662 ms 344 KB Output is correct
7 Correct 622 ms 2128 KB Output is correct
8 Correct 833 ms 2388 KB Output is correct