# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
432517 | saleh | 비스킷 담기 (IOI20_biscuits) | C++17 | 1 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"//
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXK = 60 + 3;
int dp[2][MAXK], pd[MAXK];
long long count_tastiness(long long x, vector<long long> a) {
if (x != 1) return 0;
int k = 60;
while (a.size() < k) a.push_back(0);
for (int i = 0; i < k; i++) if (a[i] > 0) {
if (a[i] % 2 == 0) {
a[i + 1] += a[i] / 2 - 1;
a[i] = 2;
} else {
a[i + 1] += a[i] / 2;
a[i] = 1;
}
}
pd[0] = 1;
dp[0][0] = 0;
dp[1][0] = (a[0] > 0? 1: 0);
for (int i = 1; i < k; i++) {
pd[i] = dp[1][i - 1] + pd[i - 1];
int tmp = i - 1;
while (tmp > 0 && a[tmp] == 1) tmp--;
if (a[tmp] == 0 || (tmp == 0 && a[tmp] == 1)) {
dp[0][i] = 0;
if (a[i] == 0) dp[1][i] = 0;
else dp[1][i] = pd[i];
} else {
dp[0][i] = dp[0][tmp] + pd[tmp];
if (a[i] == 0) dp[1][i] = dp[0][i];
else dp[1][i] = pd[i];
}
}
return dp[1][k - 1] + pd[k - 1];
}
//int32_t 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... |