Submission #83317

# Submission time Handle Problem Language Result Execution time Memory
83317 2018-11-06T23:10:35 Z josiftepe Timovi (COCI18_timovi) C++14
50 / 80
1000 ms 2228 KB
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int maxn = 2e5 + 10;
int n, k, m;
int ret[maxn];
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);

    cin >> n >> k >> m;
    memset(ret, 0, sizeof ret);
    int i = 0;
    bool R = true;
    while(m > 0){
        if(m < k){
            k = m;
        }
        if(R){
            ret[i] += k;
            i ++;
            if(i == n){
                i = n - 2;
                R = false;
            }
            m -= k;
        }
        else{
            ret[i] += k;
            i --;
            if(i == -1){
                i = 1;
                R = true;
            }
            m -= k;
        }
    }
    for(int i = 0; i < n; i ++){
        cout << ret[i] << " ";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1144 KB Output is correct
2 Correct 2 ms 1148 KB Output is correct
3 Correct 17 ms 1592 KB Output is correct
4 Correct 16 ms 1624 KB Output is correct
5 Execution timed out 1086 ms 1624 KB Time limit exceeded
6 Execution timed out 1081 ms 1624 KB Time limit exceeded
7 Correct 851 ms 2228 KB Output is correct
8 Execution timed out 1075 ms 2228 KB Time limit exceeded