Submission #374952

#TimeUsernameProblemLanguageResultExecution timeMemory
374952Jarif_Rahman비스킷 담기 (IOI20_biscuits)C++17
12 / 100
3 ms384 KiB
#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)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:11:9: warning: unused variable 'k' [-Wunused-variable]
   11 |     int k = a.size();
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...