제출 #305943

#제출 시각아이디문제언어결과실행 시간메모리
305943llaki비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1093 ms16120 KiB
#include <vector> #include <map> #include "biscuits.h" long long count_tastiness(long long x, std::vector<long long> a) { std::map<long long, long long> freq; freq[a[0]] = 1; for (int pos = 0; pos < a.size() - 1; pos++) { std::map<long long, long long> map; for (const auto &[y, value]: freq) { long long val = a[pos + 1] + y / 2; long long oldFreq = 0; if (freq.find(val) != freq.end()) { oldFreq = freq[val]; } map[val] = oldFreq + freq[y]; if (y >= x) { val = a[pos + 1] + (y - x) / 2; oldFreq = 0; if (freq.find(val) != freq.end()) { oldFreq = freq[val]; } map[val] = oldFreq + freq[y]; } } freq = map; } long long ans = 0; for (const auto &[y, value]: freq) { ans += value * (y / x + 1); } return ans; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:8:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for (int pos = 0; pos < a.size() - 1; pos++) {
      |                    ~~~~^~~~~~~~~~~~~~
#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...