이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
int ans=0;
const int DEP=60;
bool dfs(long long sum,long long dep,long long x,vector<long long> a)
{
if(dep==0 || sum<=0){
if(sum>=x) return true;
else{
++ans;
return false;
}
}
if(sum>=x*(1LL<<dep)){
bool flag=dfs(sum-max(x,a[dep])*(1LL<<dep),dep-1,x,a);
if(flag) return flag;
}
bool flag=dfs(sum-a[dep]*(1LL<<dep),dep-1,x,a);
if(flag)
ans+=(1LL<<dep);
return false;
}
long long count_tastiness(long long x, std::vector<long long> a)
{
ans=0;
while(a.size()!=DEP) a.push_back(0);
long long sum=0;
for(long long i=0;i<a.size();++i) sum+=a[i]*(1LL<<i);
if(dfs(sum,DEP-1,x,a)) ans+=(1LL<<DEP);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:35:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(long long i=0;i<a.size();++i) sum+=a[i]*(1LL<<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... |