Submission #722850

# Submission time Handle Problem Language Result Execution time Memory
722850 2023-04-13T02:31:05 Z vjudge1 Timovi (COCI18_timovi) C++17
20 / 80
1000 ms 10184 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;

    for(ll i = 0; i <= n; ){
        if(cnt >= c){
            m[i] += c;
            cnt -= c;
        }else{
            m[i] += cnt;
            cnt = 0;
        }
        if(cnt == 0)break;
        if(n >= 3){
            if(i == 2){
                a = 0;
            }else if(i == 0 && !a){
                a = 1;
            }
        }else{
            if(i == 1){
                a = 0;
            }else if( i == 0 & !a){
                a = 1;
            }
        }
        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:48:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   48 |             }else if( i == 0 & !a){
      |                       ~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 30 ms 10184 KB Output isn't correct
4 Correct 29 ms 10108 KB Output is correct
5 Execution timed out 1096 ms 212 KB Time limit exceeded
6 Execution timed out 1084 ms 212 KB Time limit exceeded
7 Execution timed out 1081 ms 212 KB Time limit exceeded
8 Execution timed out 1077 ms 212 KB Time limit exceeded