Submission #1205961

#TimeUsernameProblemLanguageResultExecution timeMemory
1205961bangan비스킷 담기 (IOI20_biscuits)C++20
0 / 100
1 ms320 KiB
#include "biscuits.h" #include <bits/stdc++.h> using i64 = long long; long long count_tastiness(long long x, std::vector<long long> a) { assert(x == 1); for (int i = 0; i < a.size(); i++) { if (i + 1 == a.size() && a[i] > 2) { a.push_back(0); } while (a[i] > 2) { a[i] -= 2; a[i + 1]++; } } int k = a.size(); i64 ans = 1; for (int l = 0; l < k;) { if (!a[l]) { l++; continue; } int r = l; while (r < k && a[r] > 0) { r++; } int lst = l - 1; for (int i = l; i < r; i++) { if (a[i] == 2) { lst = i; } } i64 ways = 1LL << (r - l); if (lst != l - 1) { ways += 1LL << (lst - l); ways--; } ans *= ways; } std::cout << ans; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:47:22: warning: control reaches end of non-void function [-Wreturn-type]
   47 |         std::cout << ans;
      |                      ^~~
#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...