제출 #457915

#제출 시각아이디문제언어결과실행 시간메모리
457915rainboy비스킷 담기 (IOI20_biscuits)C++17
9 / 100
37 ms332 KiB
#include "biscuits.h" using namespace std; typedef vector<long long> vll; const int N = 60, Z = 100000; long long max(long long a, long long b) { return a > b ? a : b; } long long count_tastiness(long long x, vll aa) { int n = aa.size(), i, cnt; long long y; if (x != 1) { cnt = 0; for (y = 0; x * y <= Z; y++) { long long a = 0; for (i = N - 1; i >= 0; i--) { if ((y & 1LL << i) != 0) a += x; a = max(a - (i < n ? aa[i] : 0), 0) * 2; } if (a == 0) cnt++; } } else { long long a; int i, j; cnt = 1, a = 0; for (i = 0, j = 0; j <= N; j++) { if (j < n) a += aa[j] << j - i; if (a < 1LL << j - i + 1) cnt *= (a + 1), a = 0, i = j + 1; } } return cnt; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, vll)':
biscuits.cpp:35:21: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   35 |     a += aa[j] << j - i;
      |                   ~~^~~
biscuits.cpp:36:25: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   36 |    if (a < 1LL << j - i + 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...