# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
826396 | Lobo | 비스킷 담기 (IOI20_biscuits) | C++17 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
long long count_tastiness(long long X, std::vector<long long> A) {
int x = X;
int k = 60;
vector<int> a(k+1,0), dp(k+1,0);
for(int i = 0; i < A.size(); i++) a[i] = A[i];
vector<int> pf(k+1,0);
pf[0] = a[0];
for(int i = 1; i <= k; i++) pf[i] = pf[i-1]+a[i]*(1LL<<i);
vector<int> pfdp(k+1,0);
for(int i = 0; i <= k; i++) {
if((1LL<<i) > (int) 1e18 / x || pf[i] < x*(1LL<<i)) {
dp[i] = 0;
pfdp[i] = dp[i] + (i == 0 ? 0 : pfdp[i-1]);
continue;
}
int sum = x*(1LL<<i)-(a[i]*(1LL<<i));
for(int j = i-1; j >= -1; j--) {
if(sum <= 0) {
dp[i]+= 1 + (j == -1 ? 0 : pfdp[j]);
break;
sum = x*(1LL<<j) - (a[j]*(1LL<<j));
}
else if(j != -1 && sum-(a[j]*(1LL<<j)) <= 0) {
dp[i]+= 1 + (j == 0 ? 0 : pfdp[j-1]);
sum = x*(1LL<<j) - (a[j]*(1LL<<j)-sum);
}
else if(j != -1) {
sum-= (a[j]*(1LL<<j));
}
}
// cout << i << " " << dp[i] << endl;
pfdp[i] = dp[i] + (i == 0 ? 0 : pfdp[i-1]);
}
return pfdp[k]+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... |