Submission #722853

# Submission time Handle Problem Language Result Execution time Memory
722853 2023-04-13T02:46:06 Z vjudge1 Timovi (COCI18_timovi) C++17
20 / 80
1000 ms 10152 KB
#include <bits/stdc++.h>
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define sts stable_sort
using namespace std;

const int MAXN = 1e6 + 4;
const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    ll n, c, cnt; cin >> n >> c >> cnt;
    if(n == 1){
        cout << cnt << "\n";
        return 0;
    }
    unordered_map<ll, ll> m;
    bool a = 1;
    int pos = 2;
    for(ll i = 0; cnt > 0; ){
        if(cnt >= c){
            m[i] += c;
            cnt -= c;
        }else{
            m[i] += cnt;
            cnt = 0;
        }
        if(n >= 3){
            if(i == pos){
                a = 0;
                pos++;
            }else if(i == 0 && !a){
                a = 1;
            }
        }else{
            if(i == 1){
                a = 0;
                pos++;
            }else if(i == 0 & !a){
                a = 1;
            }
        }
        if(pos == n)pos--;
        if(a)i++;
        else i--;
    }

    for(int i = 0; i < n; i++){
        cout << m[i] << " ";
    }
    cout << "\n";
    return 0;
}

Compilation message

timovi.cpp: In function 'int main()':
timovi.cpp:49:24: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   49 |             }else if(i == 0 & !a){
      |                      ~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 33 ms 10116 KB Output isn't correct
4 Correct 35 ms 10152 KB Output is correct
5 Execution timed out 1096 ms 212 KB Time limit exceeded
6 Execution timed out 1075 ms 212 KB Time limit exceeded
7 Execution timed out 1078 ms 768 KB Time limit exceeded
8 Execution timed out 1087 ms 716 KB Time limit exceeded