제출 #1052825

#제출 시각아이디문제언어결과실행 시간메모리
1052825ProtonDecay314비스킷 담기 (IOI20_biscuits)C++17
12 / 100
4 ms860 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef vector<vpi> vvpi; typedef vector<vpll> vvpll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef short int si; typedef vector<si> vsi; typedef vector<vsi> vvsi; #define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++) #define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--) #define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++) #define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--) #define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci #define fi first #define se second #define pb push_back #define INF(type) numeric_limits<type>::max() #define NINF(type) numeric_limits<type>::min() #define TCASES int t; cin >> t; while(t--) ll count_tastiness(ll x, vll a) { ll MAX_K = 63ll; ll ans = 1ll; // Extend a while((ll)a.size() < MAX_K) { a.pb(0ll); } ll s = 0ll; ll lastp2 = 0ll; L(i, 0ll, MAX_K) { // Whenever you reset, simply divide s by the proper power of two, and you should be good! if(a[i] >= x + 2) { ll excess = a[i] - x; a[i + 1] += excess >> 1ll; a[i] -= (excess >> 1ll) << 1ll; } ll sdx = s / x; ll curp2 = 1ll << (i - lastp2); if(sdx < curp2 - 1ll) { // "split" the interval ans *= (sdx + 1ll); // cout << sdx + 1ll << " "; a[i] += s >> (i - lastp2); s = 0ll; lastp2 = i; } curp2 = 1ll << (i - lastp2); s += a[i] * curp2; } // cout << "\n"; return ans; }
#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...