제출 #614072

#제출 시각아이디문제언어결과실행 시간메모리
614072penguinhacker비스킷 담기 (IOI20_biscuits)C++17
12 / 100
9 ms1192 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ar array ll count_tastiness(ll x, vector<ll> a) { vector<ll> v(60); for (int i=0; i<a.size(); ++i) v[i]+=(1ll*a[i])<<i; for (int i=1; i<60; ++i) v[i]+=v[i-1]; for (int i=0; i<60; ++i) v[i]/=x; vector<ar<ll, 2>> dp(60); for (int i=0; i<60; ++i) { dp[i][0]=i?dp[i-1][0]+dp[i-1][1]:1; if (v[i]>=(1ll<<i+1)-1) dp[i][1]=dp[i][0]; else if (v[i]>=1ll<<i) { dp[i][1]=1; for (ll x=v[i]-(1ll<<i); x;) { int bit=63-__builtin_clzll(x); dp[i][1]+=dp[bit][0]; x-=1ll<<bit; } //dp[i][1]=(v[i]==1ll<<i)?1:dp[63-__builtin_clzll(v[i]-(1ll<<i))][1]+dp[63-__builtin_clzll(v[i]-(1ll<<i))][0]; } //if (i<3) // cout << dp[i][0] << " " << dp[i][1] << endl; } return dp[59][0]+dp[59][1]; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:10:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for (int i=0; i<a.size(); ++i)
      |                ~^~~~~~~~~
biscuits.cpp:19:20: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   19 |   if (v[i]>=(1ll<<i+1)-1)
      |                   ~^~
#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...