제출 #805231

#제출 시각아이디문제언어결과실행 시간메모리
805231PixelCat비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1085 ms525688 KiB
#include "biscuits.h" #ifdef NYAOWO #include "grader.cpp" #endif #include <bits/stdc++.h> #define For(i, a, b) for(int i = a; i <= b; i++) #define Forr(i, a, b) for(int i = a; i >= b; i--) #define F first #define S second #define all(x) x.begin(), x.end() #define sz(x) ((int)x.size()) #define eb emplace_back #define int LL using namespace std; using i32 = int32_t; using LL = long long; using pii = pair<int, int>; const int MAXK = 60; int a[MAXK + 10]; long long count_tastiness(long long x, std::vector<long long> _a) { memset(a, 0, sizeof(a)); int k = sz(_a); For(i, 0, k - 1) { a[i] = _a[i]; } int ans = 0; priority_queue<int, vector<int>, greater<int>> pq; pq.emplace(0); while(sz(pq)) { int owo = pq.top(); pq.pop(); int hibit = k; while(hibit >= 0 && (1ll << hibit) > owo) hibit--; int cur = 0; For(i, 0, k - 1) { cur = cur / 2 + a[i]; if(owo & (1ll << i)) cur -= x; if(i > hibit && cur >= x) { pq.emplace(owo | (1ll << i)); } } cur /= 2; cur /= x; // cerr << owo << " " << cur << "\n"; ans += cur + 1; } // cerr << "\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...