某岛

AtCoder Beginner Contest 263

Original link: https://www.shuizilong.com/house/archives/atcoder-beginner-contest-263/ portal https://atcoder.jp/contests/abc263 Table of Contents portal Problem E. Sugoroku 3 Problem F. Tournament Problem G. Erasing Prime Pairs Problem Ex. Intersection 2 Problem E. Sugoroku 3 The Forgotten History of Games: ‘Mario Solitaire’ and ‘Zelda on the Table’ Problem solution: Write the transfer equation first, find that the self-loop situation can be …

AtCoder Beginner Contest 263 Read More »

[JSOI2008] Blue Mary opened a company

Original link: https://www.shuizilong.com/house/archives/jsoi2008blue-mary%E5%BC%80%E5%85%AC%E5%8F%B8/ https://www.luogu.com.cn/problem/P4254 https://darkbzoj.cc/problem/1568 This is awesome. . . #define ll double struct Line { mutable ll k, b, p; Line (ll k = 0, ll b = 0):k(k),b(b){ p = 0; } ll y(ll x) const {return k*x + b;} bool operator<(const Line& o) const { return k < ok; } bool operator<(ll …

[JSOI2008] Blue Mary opened a company Read More »

tree divide

Original link: https://www.shuizilong.com/house/archives/tree-divide/ The idea of ​​tree divide and conquer is simple, but there are many changes in details and it is difficult to template (at least I am used to adding a bunch of global variables in my code… 囧). . Specifically can be divided into. . Point divide and conquer, edge divide and …

tree divide Read More »

atl wind splay template

Original link: https://www.shuizilong.com/house/archives/atl-%E9%A3%8E-splay-%E6%A8%A1%E6%9D%BF/ It’s okay to finish a version https://github.com/lychees/last-weapon/commit/58976a70bc0948c2073091c6cf2966a16e352127 The current example uses the GSS series. . . However, GSS3 has the same code length as GSS1. . Need to delete something. . GSS6 is a good fit. . . #include <lastweapon/segtree> using namespace lastweapon; struct rec{ int ss, ls, rs, ms; rec(int s …

atl wind splay template Read More »

BZOJ #3681. Arietta

Original link: https://www.shuizilong.com/house/archives/bzoj-3681-arietta/ https://darkbzoj.cc/problem/3681 Network flow modeling is simpler than the above problem. The functional segment tree aspect requires segment tree merging. Still, it’s simpler than the previous question. const int N = int(1e4) + 9; int T[N], H[N]; VI adj[N]; int n, m; namespace Chairman_Tree { #define lx c[0][x] #define rx c[1][x] #define ly …

BZOJ #3681. Arietta Read More »

UOJ #77. A+B Problem

Original link: https://www.shuizilong.com/house/archives/uoj-77-ab-problem/ The first is the minimum cut modeling similar to POJ 3469. Dual Core CPU . The difficulty is that for each node i, we need to construct an auxiliary node i’, which is satisfied. If there is a j cut at T that satisfies the condition, then i’ must also be cut …

UOJ #77. A+B Problem Read More »

SRM 833

Original link: https://www.shuizilong.com/house/archives/srm-833/ Div1 500 DP and status can be discussed at the left and right endpoints. – https://kmjp.hatenablog.jp/entry/2022/07/10/0930 Div1 900 WW Given a string, what is the minimum cost to arrange a string in the form “WW” repeated twice. The cost is defined as the weight of each character multiplied by its displacement. https://kmjp.hatenablog.jp/entry/2022/07/10/1000 …

SRM 833 Read More »

Codechef JUNE15. Chefbook

Original link: https://www.shuizilong.com/house/archives/codechef-june15-chefbook/ https://www.codechef.com/submit/CHEFBOOK This article is reprinted from: https://www.shuizilong.com/house/archives/codechef-june15-chefbook/ This site is for inclusion only, and the copyright belongs to the original author.

Codechef FEB12. Flight Distance

Original link: https://www.shuizilong.com/house/archives/codechef-feb12-flight-distance/ https://www.codechef.com/submit/FLYDIST This article is reprinted from: https://www.shuizilong.com/house/archives/codechef-feb12-flight-distance/ This site is for inclusion only, and the copyright belongs to the original author.