제출 #661137

#제출 시각아이디문제언어결과실행 시간메모리
661137evenvalue비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1 ms560 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template<typename T> using max_heap = priority_queue<T, vector<T>, less<T>>; using int64 = long long; using ld = long double; constexpr int kInf = 1e9 + 10; constexpr int64 kInf64 = 1e15 + 10; constexpr int kMod = 1e9 + 7; constexpr int kBits = 60; int64 calc(const vector<int64> &biscuits) { int64 ans = 1; for (int i = 0; i < biscuits.size(); i++) { ans += (1LL << i) * biscuits[i]; } return ans; } int64 count_tastiness(int64 x, vector<int64> biscuits) { biscuits.push_back(0); assert(x == 1); vector<vector<int64>> segments = {{}}; const int n = (int) biscuits.size(); for (int64 i = 0, carry = 0; i < n; i++) { biscuits[i] += carry; carry = (biscuits[i] - 1) / 2; if (biscuits[i] == 0) { segments.emplace_back(); } else { segments.back().push_back(biscuits[i] - carry * 2); } } int64 ans = 1; for (const auto &segment : segments) { ans *= calc(segment); } return ans; }

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

biscuits.cpp: In function 'int64 calc(const std::vector<long long int>&)':
biscuits.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for (int i = 0; i < biscuits.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~~~~
#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...