# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
837102 | azatega | Packing Biscuits (IOI20_biscuits) | C++14 | 1084 ms | 63280 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define ll long long
map<pair<int, ll>, ll> memo;
vector<ll> a;
int n;
ll x;
ll compute(int k, ll amount){
if(memo[{k, amount}] > 0)
return memo[{k, amount}];
if(k == a.size() - 1){
// last one
ll res = 1; // can always be zero
if(amount >= x) // can be 1
res++;
memo[{k, amount}] = res;
return res;
}
ll res = 0;
if(amount >= x)
res += compute(k+1, a[k+1] + (amount - x)/2); // can be 1
res += compute(k+1, a[k+1] + amount/2); // can be 0
memo[{k, amount}] = res;
// cout << k << " - " << amount << ": " << memo[{k, amount}] << endl;
return res;
}
long long count_tastiness(long long _x, vector<long long> _a){
memo.clear();
a = _a;
x = _x;
n = _a.size();
for(int i = 0; i < 100; i++)
a.push_back(0);
for(int i = 0; i < 99; i++){
if(a[i] > x){
ll transf = (a[i] - x)/2;
a[i+1] += transf;
a[i] -= transf * 2;
}
}
return compute(0, a[0]);
}
컴파일 시 표준 에러 (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... |