https://www.lydsy.com/JudgeOnline/problem.php?id=4695
1からNの番号がついている、N個の要素列が与えられる。以下の操作を合計M回処理せよ。
- 操作1: 区間[L, R]について、xを加える
- 操作2: 区間[L, R]について、xより小さい値をxに更新
- 操作3: 区間[L, R]について、xより大きい値をxに更新
| # DSU on Tree | |
| # Ref: https://codeforces.com/blog/entry/44351 | |
| import random | |
| import time | |
| import sys | |
| random.seed() | |
| sys.setrecursionlimit(10**6) |
| package main | |
| import ( | |
| crand "crypto/rand" | |
| "crypto/sha1" | |
| "database/sql" | |
| "encoding/binary" | |
| "fmt" | |
| "html/template" | |
| "io" |
| # usage: python3 sitemap-generator.py <base_url> <base_dir> | |
| import os, sys, subprocess | |
| from datetime import datetime | |
| argv = sys.argv | |
| base_url = argv[1] | |
| base_dir = argv[2] |
| #include<algorithm> | |
| using namespace std; | |
| using ll = long long; | |
| // Segment Tree Beats (Historic Information) | |
| // - l<=i<r について a_i の値に x を加える | |
| // - l<=i<r の中の a_i の最大値を求める | |
| // - l<=i<r の中の b_i の総和を求める | |
| // - l<=i<r の中の b_i の最大値を求める | |
| // - (各クエリ後、全てのiについて b_i = max(a_i, b_i)) |
| #include<algorithm> | |
| using namespace std; | |
| using ll = long long; | |
| // Segment Tree Beats | |
| // - l<=i<r について、 a_i の値を min(a_i, x) に更新 | |
| // - l<=i<r の中の a_i の最大値を求める | |
| // - l<=i<r の a_i の和を求める | |
| #define N 10003 |
| using lli = long long int; | |
| template<typename T> | |
| class NumValid { | |
| T testVal; | |
| __int128 val128; | |
| public: | |
| NumValid() : testVal(0), val128(0) {} | |
| NumValid(T val) : testVal(val), val128(val) {} |
https://www.lydsy.com/JudgeOnline/problem.php?id=4695
1からNの番号がついている、N個の要素列が与えられる。以下の操作を合計M回処理せよ。
AtCoder: "Educational DP Coontest / DPまとめコンテスト" の提出コード
問題数が多いのでここにまとめとく。