제출 #329252

#제출 시각아이디문제언어결과실행 시간메모리
329252nikatamliani비스킷 담기 (IOI20_biscuits)C++14
0 / 100
5 ms492 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; ll count_tastiness(ll x, vector<ll> a) { ll ans = 1; for(int i = 0; i < (int)a.size() - 1; ++i) { ll mod = a[i] % x; a[i+1] += mod / 2; a[i] /= x; ll sub = (a[i] - 1) / 2 * 2; a[i+1] += sub / 2 * x; a[i] -= sub; } while(true) { ll mod = a.back() % x; ll next = mod / 2; a.back() /= x; ll sub = (a.back() - 1) / 2 * 2; next += sub / 2 * x; a.back() -= sub; if(!next) break; a.push_back(next); } a.insert(a.begin(), 0); int n = a.size(); for(ll x : a) cout << x << ' '; cout << '\n'; vector<vector<ll>> dp(n+1, vector<ll>(2, 0)); dp[0][0] = 1; for(int i = 0; i < n; ++i) { bool added[2][2]; memset(added, 0, sizeof added); for(int me = 0; me < 2; ++me) { for(int take = 0; take <= a[i]; ++take) { int new_me = take + me; int new_he = new_me / 2; new_me -= new_he * 2; if(added[new_me][new_he]) continue; added[new_me][new_he] = 1; dp[i+1][new_he] += dp[i][me]; } } } return dp[n][0] + dp[n][1]; }

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

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:27:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   27 |  for(ll x : a) cout << x << ' '; cout << '\n';
      |  ^~~
biscuits.cpp:27:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   27 |  for(ll x : a) cout << x << ' '; cout << '\n';
      |                                  ^~~~
biscuits.cpp:6:5: warning: unused variable 'ans' [-Wunused-variable]
    6 |  ll ans = 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...