题目 › egoi26-biscuits

Biscuits

EGOI 2026 · 2026-05 · L3 困难 · C++17 · 时限 3 秒 · 子任务取最低分

查看原题跳到结果

题面

来源:EGOI 2026 官方 PDF。模型收到的是由同一份 Typst 源文件转换的文字。

EGOI 2026 Biscuits 官方题面第 1 页EGOI 2026 Biscuits 官方题面第 2 页EGOI 2026 Biscuits 官方题面第 3 页

结果

Kimi K3.1 ProKimi

auto(max)

3/3

解出的采样 ↑

  • 100采样 1 · 解出
  • 100采样 2 · 解出
  • 100采样 3 · 解出
  • 10.0k平均输出 token(含思考) ↓
  • 29.3输出速度 tokens/s ↑
  • 344 秒延迟 ↓

DeepSeek Flash V4.1-1017DeepSeek

auto(high)

3/3

解出的采样 ↑

  • 100采样 1 · 解出
  • 100采样 2 · 解出
  • 100采样 3 · 解出
  • 12.3k平均输出 token(含思考) ↓
  • 210.0输出速度 tokens/s ↑
  • 62 秒延迟 ↓

MiniMax M3.1 FlashMiniMax

auto(max)

3/3

解出的采样 ↑

  • 100采样 1 · 解出
  • 100采样 2 · 解出
  • 100采样 3 · 解出
  • 16.2k平均输出 token(含思考) ↓
  • 136.0输出速度 tokens/s ↑
  • 130 秒延迟 ↓

↑ 越大越好,↓ 越小越好。得分 0–100,按官方时限判定,所有测试点都满分才算解出。CPU 时间 / 官方解为解出的答案在官方解最慢的 3 个测试点上的 CPU 时间之比(几何平均),只比较官方解至少需要 0.05 秒的题;复杂度按增长幂次相对官方解分类。判题与计分见 原理。

代码

Kimi K3.1 Pro · 采样 1 · 85 行
#include <bits/stdc++.h>
using namespace std;

constexpr int MAX_W = 50;

struct Node {
    unsigned char nxt[MAX_W + 1];
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, Q;
    cin >> N >> Q;

    vector<int> w(N);
    long long totalWeight = 0;
    for (int &x : w) {
        cin >> x;
        totalWeight += x;
    }

    int size = 1;
    while (size < N) size <<= 1;

    vector<Node> seg(2 * size);

    auto setLeaf = [&](int p, int weight) {
        for (int d = 0; d <= MAX_W; ++d) {
            seg[p].nxt[d] = static_cast<unsigned char>(
                d >= weight ? d - weight : weight - d
            );
        }
    };

    auto pull = [&](int p) {
        const auto &top = seg[p << 1].nxt;
        const auto &bottom = seg[p << 1 | 1].nxt;
        auto &res = seg[p].nxt;

        for (int d = 0; d <= MAX_W; ++d) {
            res[d] = top[bottom[d]];
        }
    };

    for (int i = 0; i < size; ++i) {
        if (i < N) {
            setLeaf(size + i, w[i]);
        } else {
            for (int d = 0; d <= MAX_W; ++d) {
                seg[size + i].nxt[d] = static_cast<unsigned char>(d);
            }
        }
    }

    for (int p = size - 1; p >= 1; --p) {
        pull(p);
    }

    auto answer = [&]() -> long long {
        return (totalWeight - seg[1].nxt[0]) / 2;
    };

    cout << answer() << '\n';

    while (Q--) {
        int P, Z;
        cin >> P >> Z;

        totalWeight += Z - w[P];
        w[P] = Z;

        int p = size + P;
        setLeaf(p, Z);

        while ((p >>= 1) != 0) {
            pull(p);
        }

        cout << answer() << '\n';
    }

    return 0;
}