# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
332194 | pggp | 비스킷 담기 (IOI20_biscuits) | C++14 | 1080 ms | 768 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x, vector < long long > k){
if(x <= 10000){
k.resize(62);
for (long long i = 0; i < k.size() - 1; ++i)
{
if(k[i] > x){
k[i + 1] += (k[i] - x)/2;
k[i] -= 2 * ((k[i] - x)/2);
}
//cout << "k: " << k[i] << endl;
}
long long DP[2 * x + 2];
long long DP1[2 * x + 2];
for (long long j = 0; j < 2 * x + 2; ++j)
{
DP[j] = DP1[j] = 0;
}
DP[k[0]] = 1;
for (long long i = 0; i < k.size() - 1; ++i)
{
// używamy x
for (long long j = 0; j < 2 * x + 2 and k[i + 1] + (j - x) / 2 < 2 * x + 2; ++j)
{
if(j >= x){
DP1[k[i + 1] + (j - x) / 2] += DP[j];
}
}
// nie używamy x
for (long long j = 0; j < 2 * x + 2 and k[i + 1] + j / 2 < 2 * x + 2; ++j)
{
DP1[k[i + 1] + j / 2] += DP[j];
}
for (long long j = 0; j < 2 * x + 2; ++j)
{
//cout << DP1[j] << " ";
}
for (long long j = 0; j < 2 * x + 2; ++j)
{
DP[j] = DP1[j];
DP1[j] = 0;
}
//cout << endl;
}
long long sum = 0;
for (long long i = 0; i < 2 * x + 1; ++i)
{
sum += DP[i];
}
return sum;
}
else{
long long total_tastiness = 0;
long long cur_pow = 1;
k.resize(62);
for (int i = 0; i < k.size(); ++i)
{
total_tastiness += cur_pow * k[i];
cur_pow *= 2;
}
int ans = 1;
long long k_cur;
for(int y = 1; y <= total_tastiness; y++){
int y_cur = y;
int y_dig = 0;
bool possible = true;
k_cur = k[0];
while(y_cur > 0){
//cout << "y_cur:" << y_cur << endl;
//cout << "k_cur:" << k_cur << endl;
if(y_cur % 2 == 1){
k_cur -= x;
if(k_cur < 0){
possible = false;
}
}
k_cur /= 2;
k_cur += k[y_dig + 1];
y_dig++;
y_cur /= 2;
}
if(possible){
//cout << "p: " << y << endl;
}
ans += possible;
}
return ans;
}
}
컴파일 시 표준 에러 (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... |