Submission #94605

# Submission time Handle Problem Language Result Execution time Memory
94605 2019-01-21T15:55:22 Z ahmedie404 Timovi (COCI18_timovi) C++14
50 / 80
1000 ms 1528 KB
#include <iostream>

using namespace std;

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

    scanf("%d %lld %lld", &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

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 %lld %lld", &n, &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 15 ms 1528 KB Output is correct
4 Correct 15 ms 1528 KB Output is correct
5 Execution timed out 1081 ms 376 KB Time limit exceeded
6 Correct 910 ms 376 KB Output is correct
7 Execution timed out 1083 ms 1016 KB Time limit exceeded
8 Execution timed out 1083 ms 1016 KB Time limit exceeded