QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#191570#5252. DeforestationtimreizinWA 24ms3392kbC++20990b2023-09-30 01:47:372023-09-30 01:47:37

Judging History

你现在查看的是最新测评结果

  • [2023-09-30 01:47:37]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:3392kb
  • [2023-09-30 01:47:37]
  • 提交

answer

#include <vector>
#include <queue>
#include <list>
#include <iostream>
#include <array>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>

using namespace std;

using ll = long long;
using ld = long double;

int main()
{
    ll w, res = 0;
    cin >> w;
    auto dfs = [&w, &res](auto self) -> ll
    {
        ll m;
        int n;
        cin >> m >> n;
        vector<ll> children;
        for (int i = 0; i < n; ++i)
            children.push_back(self(self));
        sort(children.rbegin(), children.rend());
        ll sum = accumulate(children.begin(), children.end(), 0ll);
        while (sum > w)
        {
            sum -= children.back();
            children.pop_back();
            ++res;
        }
        if (sum + m < w)
            return sum + m;
        m -= w - sum;
        res += m / w + 1;
        return m % w;
    };
    ll last = dfs(dfs);
    cout << res + last / w << '\n';
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 24ms
memory: 3392kb

input:

999900000
7339 3
14947 2
12850 3
8986 10
11599 9
8889 10
10711 4
8015 1
11626 0
9492 1
7017 0
8863 0
8632 0
5321 5
9906 0
11687 0
9845 0
10469 0
11708 0
14950 5
11934 0
11922 0
13101 0
12000 0
9082 0
9273 5
12296 0
6119 0
9201 0
12652 0
12957 0
7454 5
12515 0
12976 0
10358 0
13997 0
8371 0
10181 5
8...

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'