제출 #613950

#제출 시각아이디문제언어결과실행 시간메모리
613950penguinhacker비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1085 ms340 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]=(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];*/ int ans=0; for (int i=0; i<=100000; ++i) { bool ok=1; for (int j=0; j<30; ++j) { if ((i&(1<<j+1)-1)>v[j]) { ok=0; break; } } ans+=ok; } return ans; }

컴파일 시 표준 에러 (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:31:16: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   31 |    if ((i&(1<<j+1)-1)>v[j]) {
      |               ~^~
biscuits.cpp:31:19: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   31 |    if ((i&(1<<j+1)-1)>v[j]) {
      |           ~~~~~~~~^~
#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...