제출 #1205960

#제출 시각아이디문제언어결과실행 시간메모리
1205960bangan비스킷 담기 (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 = 0; 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; } } ans += 1LL << (r - l); if (lst != l - 1) { ans += 1LL << (lst - l); ans--; } } std::cout << ans; }

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

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