Submission #374781

# Submission time Handle Problem Language Result Execution time Memory
374781 2021-03-08T07:06:06 Z Jarif_Rahman Packing Biscuits (IOI20_biscuits) C++17
0 / 100
1 ms 364 KB
#include "biscuits.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
ll count_tastiness(ll x, vector<ll> a){
    int k = a.size();
    a.resize(3*k, 0);
    ll ans = 0, ls = 1, cur = 1;
    vector<ll> cnt1(3*k, 0), cnt2(3*k, 0);
    for(int i = 0; i < 3*k; i++){
        if(i != 0){
            cnt1[i] = cnt1[i-1];
            cnt2[i] = cnt2[i-1];
        }
        if(a[i] == 0){
            ls*=cur;
            cur = 1;
            cnt1[i] = 0;
            cnt2[i] = 0;
            continue;
        }
        cur = cnt1[i];
        if(a[i] > 1) cur+=cnt2[i];
        cur = 1LL<<cur;
        if(a[i] == 1){
            for(int j = i-1; j >= 0; j--){
                if(cnt1[j] == 0 && cnt2[j] == 0) break;
                if(a[j] == 1){
                    ll a = cnt1[j]-1, b = cnt2[j];
                    b = 1LL<<b;
                    b--;
                    a = 1LL<<a;
                    a*=b;
                    cur+=a;
                }
            }
        }
        ans+=cur*ls;
        if(a[i]%2 == 0) cnt2[i]++;
        else cnt1[i]++;
        if(i != 3*k-1) a[i+1]+=a[i]/2;
        a[i]%=2;
    }
    ans++;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -