# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
374952 | Jarif_Rahman | 비스킷 담기 (IOI20_biscuits) | C++17 | 3 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
const int kk = 200;
ll count_tastiness(ll x, vector<ll> a){
int k = a.size();
a.resize(kk, 0);
ll ans = 1, c1 = 0, c2 = 0, cur = 1;
int block = -1;
for(int i = 0; i < kk-1; i++){
if(a[i] == 0) continue;
if(a[i]%2 == 0) a[i+1]+=(a[i]-2)/2, a[i] = 2;
else a[i+1]+=a[i]/2, a[i]%=2;
}
for(int i = 0; i < kk; i++){
if(a[i] > 0){
ll s = c1+c2;
s = 1LL<<s;
cur+=s;
(a[i] == 1? c1:c2)++;
}
else{
for(int j = i-1; j > block; j--){
if(a[j] == 1) c1--;
if(a[j] == 2){
c2--;
ll s = c1+c2;
s = 1LL<<s;
cur+=s;
}
}
ans*=max(1LL, cur);
cur = 1;
c1 = 0, c2 = 0;
block = i;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |