| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 335543 | aanastasov | Packing Biscuits (IOI20_biscuits) | C++17 | 34 ms | 1152 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
 
#include <cassert>
//#include <iostream>
 
typedef long long int64_t;
 
int64_t count_tastiness(int64_t numGroups, std::vector<int64_t> initialCount) {
    while (initialCount.size() < 62) initialCount.push_back(0);
    int64_t spareCount = 0;
    auto numWays = std::vector<int64_t>{1};
    for (int64_t i = 0; i < initialCount.size(); ++i) {
        if (initialCount[i] + spareCount >= numGroups) {
            spareCount = spareCount + initialCount[i] - numGroups;
            assert(spareCount >= 0);
            numWays.push_back(numWays.back() * 2);
        } else {
            int64_t maxPossible = 0;
            int64_t availableQty = 0;
            for (int64_t j = 0; j <= i; ++j) availableQty += initialCount[j] << j;
            int64_t borrowedQty = 0;
            for (int64_t j = i; j >= 0; --j) {
                assert(availableQty >= borrowedQty);
                assert((borrowedQty % (1LL << j)) == 0);
                int64_t curCount = initialCount[j];
                int64_t returnedQty = std::min(borrowedQty, curCount << j);
                curCount -= returnedQty >> j;
                availableQty -= returnedQty;
                borrowedQty -= returnedQty;
                assert(curCount >= 0 && curCount <= initialCount[j]);
                if (((availableQty - borrowedQty) >> j) < numGroups) {
                    availableQty -= curCount << j;
                    continue;
                }
                borrowedQty += numGroups << j;
                borrowedQty = std::max(0LL, borrowedQty - (curCount << j));
                availableQty -= curCount << j;
                maxPossible |= 1LL << j;
            }
            assert(borrowedQty == 0);
            int64_t curWays = 0;
            for (int64_t j = 0; j < i + 1; ++j) {
                if (((maxPossible + 1) & (1LL << j)) > 0) curWays += numWays[j];
            }
            numWays.push_back(curWays);
            spareCount = 0;
        }
        spareCount >>= 1LL;
    }
    return numWays.back();
}
 
컴파일 시 표준 에러 (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... | ||||
