Submission #94606

#TimeUsernameProblemLanguageResultExecution timeMemory
94606ahmedie404Timovi (COCI18_timovi)C++14
50 / 80
1075 ms1528 KiB
#include <iostream>

using namespace std;

int ts[200000+9];
int n;
int k, m;
int main(){

    scanf("%d %d %d", &n, &k, &m);

    for(int i=0;i<n;i++) ts[i]=0;

    int idx=0;
    bool forw=true;
    while(true){

        if(idx >= n){
            idx = n-2;
            forw = false;
        }

        if(idx < 0){
            idx = 1;
            forw = true;
        }

        if(k > 0 && m > 0){

            ts[idx] += ( m >= k ) ? k : m;
            m-=( m >= k ) ? k : m;
            idx += forw == true ? 1 : -1;

        } else break;

    }

    for(int i=0;i<n;i++){
        printf("%d ", ts[i]);
    }



    return 0;
}

Compilation message (stderr)

timovi.cpp: In function 'int main()':
timovi.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...