제출 #1055554

#제출 시각아이디문제언어결과실행 시간메모리
1055554Trent비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1122 ms1055244 KiB
#include "biscuits.h" #include "bits/stdc++.h" using namespace std; #define forR(i, x) for(int i = 0; i < (x); ++i) #define REP(i, a, b) for(int i = (a); i < (b); ++i) #define all(x) x.begin(), x.end() typedef long long ll; typedef vector<ll> vll; ll INF = 1e18 + 10; // a - b*c >= 0 when a <= 1e18 ll gte0(ll a, ll b, ll c) { if(b > INF / c) return false; return a - b*c >= 0; } long long count_tastiness(long long x, std::vector<long long> a) { a.insert(a.begin(), (ll) 0); int k = 60; while(a.size() < k) a.push_back(0); vll sm(k); sm[0] = a[0]; REP(i, 1, k) sm[i] = sm[i-1] + (1LL << (i-1)) * a[i]; vll vals = {sm[k-1]}; for(int i = k - 1; i > 0; --i) { vll nex; for(ll j : vals) { j = min(j, sm[i]); nex.push_back(j); if(gte0(j, 1LL << (i-1), x)) nex.push_back(j - (1LL << (i-1)) * x); } vals.swap(nex); } return vals.size(); }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:19:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |  while(a.size() < k) a.push_back(0);
      |        ~~~~~~~~~^~~
#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...