제출 #730391

#제출 시각아이디문제언어결과실행 시간메모리
730391danikoynov비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1082 ms340 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll maxk = 63; ll n, dp[maxk], b[maxk]; long long count_tastiness(long long x, vector<long long> a) { a.resize(20); n = a.size(); ll sum = 0; for (int i = 0; i < n; i ++) { sum += a[i] * ((ll)(1) << i); } ll ans = 0; for (ll d = 0; d <= sum; d ++) { for (int i = 0; i < 20; i ++) b[i] = a[i]; bool tf = true; for (ll bit = 0; bit < 20; bit ++) { ///cout << bit << " : " << b[bit] << endl; if ((d & (1 << bit)) > 0) { ///cout << "yes" << endl; if (b[bit] < x) { tf = false; break; } b[bit] -= x; } b[bit + 1] = b[bit + 1] + b[bit] / 2; } ///cout << d << " " << tf << endl; if (tf) ans ++; } ///cout << ans << endl; return ans; } /**long long count_tastiness_fast(long long x, vector<long long> a) { a.resize(maxk); n = a.size(); b[0] = a[0]; for (int i = 1; i < maxk; i ++) { b[i] = b[i - 1] / 2 + a[i]; } dp[0] = 1; if (a[0] >= x) dp[0] ++; for (ll i = 1; i < maxk; i ++) { dp[i] = 0; if (b[i] < x) { ///cout << "here " << i << " " << b[i] << " " << x << endl; dp[i] = dp[i - 1]; continue; } dp[i] = dp[i - 1]; if (a[i] >= x) { dp[i] += dp[i - 1]; continue; } ll nec = (x - a[i]) * 2; for (int j = i - 1; j >= 0; j --) { ///cout << i << " : " << j << " : " << nec << " : " << a[j] << endl; if (a[j] >= nec + x) { dp[i] = dp[i] + dp[j]; break; } if (a[j] >= nec) { if (j == 0) dp[i] ++; else dp[i] = dp[i] + dp[j - 1]; nec = (x - (a[j] - nec)) * 2; } else { nec = (nec - a[j]) * 2; } } } for (int j = 0; j < 5; j ++) cout << dp[j] << " "; cout << endl; return dp[maxk - 1]; }*/

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:23:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   23 |         for (int i = 0; i < 20; i ++)
      |         ^~~
biscuits.cpp:26:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   26 |             bool tf = true;
      |             ^~~~
#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...