Submission #307892

# Submission time Handle Problem Language Result Execution time Memory
307892 2020-09-29T13:48:24 Z Vimmer Packing Biscuits (IOI20_biscuits) C++14
0 / 100
1000 ms 896 KB
#include <bits/stdc++.h>
#include "biscuits.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define N 100005
#define PB push_back
#define sz(x) int(x.size())
#define F first
#define M ll(1e9 + 7)
#define S second
#define all(x) x.begin(), x.end()
#define endl '\n'

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
//typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll count_tastiness(ll x, vector<ll> a)
{
    ll ans = 1;

    ll sum = 0;

    int n = sz(a);

    for (int i = 0; i < n; i++) sum += a[i];

    for (ll cur = sum / x; cur >= 1; cur--)
    {
        bool gd = 1;

        ll b[n];

        for (int i = 0; i < n; i++) b[i] = a[i];

        for (int j = n - 1; j >= 0; j--)
            if ((1 << j) & cur)
            {
                ll need = x;

                int u = j;

                while (u >= 0 && need > 0)
                {
                    ll mn = min(need, b[u]);

                    b[u] -= mn;

                    need -= mn;

                    u--;

                    need *= 2;
                }

                if (need != 0) {gd = 0; break;}
            }


        if (gd) ans++;
    }

    return ans;
}

//int main()
//{
//    iostream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//
//    freopen("1.in", "r", stdin); //freopen("fcolor.out", "w", stdout);
//
//    int n;
//
//    cin >> n;
//
//    int num = 0;
//
//    for (int i = 0; i < n; i++) {cin >> val[i]; if (val[i] == 0) num++;}
//
//    cout << num << endl;
//
//    cout << count_mushrooms(n) << endl;
//
//    cout << kol << endl;
//}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 578 ms 504 KB Output is correct
2 Incorrect 13 ms 896 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -