# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333321 | nickmet2004 | Packing Biscuits (IOI20_biscuits) | C++14 | 93 ms | 1004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "biscuits.h"
#define ll long long
using namespace std;
ll Xk;
ll dp[61] , Pr[61];
ll Q(ll w){
if(w < 0ll)return 0ll;
if(!w) return 1ll;
int j;
for(j = 60; ~j; --j) if((1ll << j) <= w)break;
return dp[j] + Q(min(w , Pr[j] / Xk) - (1ll << j));
}
ll count_tastiness(ll X , vector<ll> a){
int n = a.size(); Xk = X;
a.resize(60);
for(int i = 0; i < 60; ++i){
Pr[i] = (1ll << i) * a[i];
if(i)Pr[i] += Pr[i - 1];
}
//for(int i= 0; i < n; ++i)cout << Pr[i] << " "; cout << endl;
dp[0] = 1ll;
/// 2^k___2^(k+1) - 1
/// dp[k + 1] = dp[k] + a;
for(int k = 1; k < 61; ++k) dp[k] = Q((1ll << k) - 1ll);
return dp[60];
}
/*
int main (){
cout << count_tastiness(3 , {5 , 2 , 1});
}
*/
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |