From 86ffef0390041274918886023c057a1a2bf3a478 Mon Sep 17 00:00:00 2001 From: hitonanode <32937551+hitonanode@users.noreply.github.com> Date: Sun, 28 Apr 2024 22:21:01 +0900 Subject: [PATCH] add hack cases for wrong beats --- .../gen/small_absolute_values.cpp | 51 +++++++++++++++++++ .../range_chmin_chmax_add_range_sum/hash.json | 8 ++- .../range_chmin_chmax_add_range_sum/info.toml | 3 ++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 datastructure/range_chmin_chmax_add_range_sum/gen/small_absolute_values.cpp diff --git a/datastructure/range_chmin_chmax_add_range_sum/gen/small_absolute_values.cpp b/datastructure/range_chmin_chmax_add_range_sum/gen/small_absolute_values.cpp new file mode 100644 index 000000000..c832cb482 --- /dev/null +++ b/datastructure/range_chmin_chmax_add_range_sum/gen/small_absolute_values.cpp @@ -0,0 +1,51 @@ +#include "random.h" +#include +#include +#include +#include "../params.h" +#include "../segtree.hpp" + +using namespace std; + +int main(int, char* argv[]) { + long long seed = atoll(argv[1]); + auto gen = Random(seed); + + const long long SMALL_A_ABS_MAX = 100; + + int n = gen.uniform(1, N_AND_Q_MAX); + int q = gen.uniform(1, N_AND_Q_MAX); + printf("%d %d\n", n, q); + vector init(n); + for (int i = 0; i < n; i++) { + long long a = gen.uniform(-SMALL_A_ABS_MAX, SMALL_A_ABS_MAX); + printf("%lld", a); + if (i != n - 1) printf(" "); + init[i] = { a, a }; + } + printf("\n"); + chmin_chmax_add_min_max_segment_tree segtree(init.begin(), init.end()); + + for (int i = 0; i < q; i++) { + int t = gen.uniform(0, 3); + int l, r; + tie(l, r) = gen.uniform_pair(0, n); + if (t == 0) { + long long b = gen.uniform(-SMALL_A_ABS_MAX, SMALL_A_ABS_MAX); + printf("%d %d %d %lld\n", t, l, r, b); + segtree.range_apply(l, r, (typename chmin_chmax_add_monoid::value_type) { b, LLONG_MIN, 0ll }); + } else if (t == 1) { + long long b = gen.uniform(-SMALL_A_ABS_MAX, SMALL_A_ABS_MAX); + printf("%d %d %d %lld\n", t, l, r, b); + segtree.range_apply(l, r, (typename chmin_chmax_add_monoid::value_type) { LLONG_MAX, b, 0ll }); + } else if (t == 2) { + auto c = segtree.range_get(0, n); + long long b = gen.uniform(-SMALL_A_ABS_MAX - c.min, SMALL_A_ABS_MAX - c.max); + segtree.range_apply(l, r, (typename chmin_chmax_add_monoid::value_type) { LLONG_MAX, LLONG_MIN, b }); + printf("%d %d %d %lld\n", t, l, r, b); + } else { + printf("%d %d %d\n", t, l, r); + } + } + return 0; +} diff --git a/datastructure/range_chmin_chmax_add_range_sum/hash.json b/datastructure/range_chmin_chmax_add_range_sum/hash.json index 8c0541039..39d2f18c5 100644 --- a/datastructure/range_chmin_chmax_add_range_sum/hash.json +++ b/datastructure/range_chmin_chmax_add_range_sum/hash.json @@ -50,5 +50,11 @@ "small_08.in": "de54614c264210e47609898635bcfb6440f059a0895a1a078c2d831ef7a732eb", "small_08.out": "f1270aed58f4d85cde341cfcdb81773760f0e9609bc6764bfc2fca05d8d229c3", "small_09.in": "9e7e4fe32e402a6a5a928a8ef9531fcebf201f04eac1f222f1aa47d2cf842a70", - "small_09.out": "50bac94959608ff81cfdc25cca9b674fd9fe38f1c8bb3ea50c031339f1d6acdc" + "small_09.out": "50bac94959608ff81cfdc25cca9b674fd9fe38f1c8bb3ea50c031339f1d6acdc", + "small_absolute_values_00.in": "dcc385dff6e3488a4651c94730d3483cf602df333174e99c22018532de717df0", + "small_absolute_values_00.out": "4a2b6788fcf71dd2a368f2bbb11b018b3577227f031dcba2b970eaf7d5ab2fec", + "small_absolute_values_01.in": "7a1ee8ba0d3eb3ad58bcb54dcc65c0bc6f0ce715c8fd7708ae5eefa1217086c9", + "small_absolute_values_01.out": "a3619c7662b614f3b07cca6ab4d753d591a203a78a04a0cc20dc1b002e77f52e", + "small_absolute_values_02.in": "8bf67d5d93dac15a5ad7122be83c2545bf5b86d742e46993cb7b9aeca2f9547d", + "small_absolute_values_02.out": "101c7f11f2b4ca4d23c5a04ef4235110fa06eadfe03f79ddcff6638e305c9855" } diff --git a/datastructure/range_chmin_chmax_add_range_sum/info.toml b/datastructure/range_chmin_chmax_add_range_sum/info.toml index b874a650e..e3bcb46bd 100644 --- a/datastructure/range_chmin_chmax_add_range_sum/info.toml +++ b/datastructure/range_chmin_chmax_add_range_sum/info.toml @@ -23,6 +23,9 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/243" [[tests]] name = "max_random.cpp" number = 3 +[[tests]] + name = "small_absolute_values.cpp" + number = 3 [[solutions]] name = "correct_with_assert.cpp"