이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "biscuits.h"
using namespace std;
using ll = long long;
ll INF = 1e18;
ll count_tastiness(ll x, vector<ll> a) {
ll ans = 0, sum = 0;
for(int i=0;i<a.size();i++) sum += (1ll << i) * a[i];
ll mx = sum / x;
while((1ll << a.size()) < mx) a.push_back(0);
queue<ll> qu, qc, ql;
qu.push(0), qc.push(0), ql.push(0), ans++;
while(!qu.empty()){
ll u = qu.front(), c = qc.front(), l = ql.front() / 2 + a[c]; qu.pop(), qc.pop(), ql.pop();
if(u + (1ll << c) > mx) continue;
qu.push(u), qc.push(c + 1), ql.push(l);
if(l >= x){
ans++;
qu.push(u + (1ll << c)), qc.push(c + 1), ql.push(l - x);
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:10:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
10 | for(int i=0;i<a.size();i++) sum += (1ll << i) * a[i];
| ~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |