Giter Club home page Giter Club logo

Comments (4)

guoyiz23 avatar guoyiz23 commented on June 26, 2024 1

ごめんなさい、悪いです。 どうもありがとう。

I got AC now. As for the machine translate generated above, I do not actually know Japanese other than the meaning of the Kanji, but AtCoder did inspire me to more seriously learn it. xD

私は実際に日本人とあまり話したことはありませんが、そのうち話すようになるかもしれません。

from library-checker-problems.

maspypy avatar maspypy commented on June 26, 2024

On your implementation

I think Your implementation in atcoder/ac-library#175 is just wrong, and it is not a bug of AtCoder Library.

As writtern in the document of lazy segtree of ACL: https://github.com/atcoder/ac-library/blob/master/document_en/lazysegtree.md
$f(x\cdot y)=f(x)\cdot f(y)$ is needed. $f\colon x\mapsto x+c$ doesn't satisfy the condition.

I think the correct implementation looks like:

struct T {
  lint count, sum;
};

T op(T a, T b) { return {a.count + b.count, a.sum + b.sum}; }
T e() { return {0, 0}; }

T mapping(lint f, T x) { return {x.count, x.sum + f * x.count}; }
lint composition(lint f, lint g) { return f + g; }

We need to add $f$ to some aggregated data of a interval. If we keep only the sum, we can't find the resulted data.
By keeping both count and sum, we can get the result.

from library-checker-problems.

maspypy avatar maspypy commented on June 26, 2024

On the problem proposal

We can verify the lazysegtree implementation by the following problem.
https://judge.yosupo.jp/problem/range_affine_range_sum

Furthermore, range add operation is a special case of range affine operation ($b=1$).
So I think we don't need a new problem.
However, we could consider adding it if there are new algorithms that need verification and cannot be tested in the existing problem.

If some hack cases are required, it should be added to range_affine_range_sum.

from library-checker-problems.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.