제출 #1074555

#제출 시각아이디문제언어결과실행 시간메모리
1074555TheQuantiX비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1067 ms444 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; ll n, m, q, k, x, y, a, b, c; long long count_tastiness(long long x, vector<long long> a) { ll sum = 0; for (int i = 0; i < a.size(); i++) { sum += a[i] * (1 << i); } if (x == 1) { ll ans = 1; ll mx = 0; ll last = 1; ll e = 1; for (int i = 0; i < a.size(); i++) { if (mx < (1LL << i) - 1) { ans += mx / last; e *= (mx / last + 1); mx = 0; last = (1LL << i); } mx += a[i] * (1LL << i) * e; } ans += mx / last; return ans; // cout << ans << '\n'; } ll ans = 1; for (int i = 1; i <= sum / x; i++) { vector<ll> arr = a; bool fl = 1; for (int j = 0; j < x; j++) { ll e = i; for (int k = arr.size() - 1; k >= 0; k--) { ll x = min(e / (1LL << k), arr[k]); arr[k] -= x; e -= (1LL << k) * x; } if (e != 0) { fl = 0; break; } } if (fl) { // cout << i << '\n'; ans++; } } return ans; }

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

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