Skip to content

ModInt overflow issue #2

Description

@plasmatic1

template <typename U> static T normalize(const U& x) {

assumes that the initial value of U can be held in T. This is not always the case (i.e. when U is int64_t and T is int32_t). To fix this, change the line to T res = x % mod();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions