제출 #782577

#제출 시각아이디문제언어결과실행 시간메모리
782577_martynas비스킷 담기 (IOI20_biscuits)C++14
0 / 100
3 ms312 KiB
#include "biscuits.h" #include <set> #include <iostream> #include <algorithm> #include <unordered_map> #include <map> using namespace std; using ll = long long; #warning change mxk to 60 const int mxk = 60; unordered_map<ll, ll> memo; ll solve(ll n, ll x, vector<ll> &pref) { if(n == 1) return 1; if(n <= 0) return 0; if(memo.count(n)) return memo[n]; ll val = 0; int msb = 31-__builtin_clz(n-1); val += solve(1LL<<msb, x, pref); val += solve(min(n, 1+pref[msb]/x)-(1LL<<msb), x, pref); memo[n] = val; return val; } ll count_tastiness(ll x, vector<ll> a) { memo.clear(); vector<ll> pref(mxk); for(int i = 0; i < a.size(); i++) { pref[i] = (1LL<<i)*a[i]+(i?pref[i-1]:0); } ll ans = solve(1LL<<mxk, x, pref); return ans; }

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

biscuits.cpp:12:2: warning: #warning change mxk to 60 [-Wcpp]
   12 | #warning change mxk to 60
      |  ^~~~~~~
biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     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...