제출 #425559

#제출 시각아이디문제언어결과실행 시간메모리
425559muhammad_hokimiyon비스킷 담기 (IOI20_biscuits)C++14
0 / 100
2 ms332 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, std::vector<long long> a) { long long ans = 1; vector<long long> b(101, 0ll); for(int i = 0; i < 100; i++){ if(i < (int)a.size())b[i] += a[i]; b[i + 1] += (b[i] - 1ll) / 2; b[i] -= (b[i] - 1ll) / 2 * 2; } int cnt = 0; for(int i = 0; i < 100; i++){ if(b[i] > 0ll)ans += ans,cnt++; } for(int i = 0; i < 100; i++){ if(b[i] == 2ll && b[i + 1] == 0ll){ ans += (1ll << cnt - 1); } } return ans; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:20:44: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   20 |                         ans += (1ll << cnt - 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...