답안 #834792

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
834792 2023-08-22T19:32:09 Z finn__ 비스킷 담기 (IOI20_biscuits) C++17
0 / 100
815 ms 2097152 KB
#include <bits/stdc++.h>

#include "biscuits.h"

using namespace std;
using L = long long;

constexpr size_t N = 61;

int64_t b[N], c[N], x;

int64_t f(int64_t n)
{
    size_t const j = __countl_zero(n);
    if (1LL << j == n && c[j] != -1)
        return c[j];
    size_t const i = __countl_zero(n - 1);
    int64_t ans = f(1LL << i) + f(min(n, b[i] / x + 1) - (1LL << i));
    if (1LL << j == n)
        c[j] = ans;
    return ans;
}

L count_tastiness(L x_, vector<L> a)
{
    x = x_;
    memset(b, 0, sizeof b);
    memset(c, 255, sizeof c);
    c[0] = 1;
    b[0] = a[0];
    for (size_t i = 1; i < a.size(); ++i)
        b[i] = b[i - 1] + a[i] * (1LL << i);
    return f(1LL << 60);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 815 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 711 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 733 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 730 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 815 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -