제출 #838499

#제출 시각아이디문제언어결과실행 시간메모리
838499caganyanmaz비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1 ms596 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long using namespace std; //#define DEBUGGING #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif constexpr static int MXK = 62; ll count_tastiness(ll x, vector<ll> a) { assert(x == 1); int k = a.size(); while (a.size() < MXK-1) a.pb(0); for (int i = 0; i < MXK; i++) { ll change = max<ll>((a[i] - x) / 2, 0); a[i+1] += change; a[i] -= change * 2; } vector<ll> pf(MXK, 0); pf[0] = 0; for (int i = 1; i < MXK; i++) pf[i] = pf[i-1] + (a[i-1] << (i-1)); vector<ll> dp(MXK, 0); // Last open bit dp[0] = 1; for (int i = 1; i < MXK; i++) for (int j = 0; j < i; j++) if ((pf[i] - pf[j]) >= (x<<(i-1))) dp[i] += dp[j]; ll res = 0; for (int i = 0; i < MXK; i++) res += dp[i]; debug(dp, res); return res; }

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:18:6: warning: unused variable 'k' [-Wunused-variable]
   18 |  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...