답안 #94604

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94604 2019-01-21T15:50:32 Z ahmedie404 Timovi (COCI18_timovi) C++14
40 / 80
1000 ms 1532 KB
#include <iostream>

using namespace std;

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

    cin >> 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;
            continue;
        }

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

        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++){
        cout << ts[i] << " ";
    }

    cout << endl;



    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 16 ms 1532 KB Output is correct
4 Correct 16 ms 1532 KB Output is correct
5 Execution timed out 1074 ms 256 KB Time limit exceeded
6 Execution timed out 1034 ms 376 KB Time limit exceeded
7 Execution timed out 1075 ms 1144 KB Time limit exceeded
8 Execution timed out 1074 ms 1144 KB Time limit exceeded