某岛

AtCoder Regular Contest 146

Original link: https://www.shuizilong.com/house/archives/atcoder-regular-contest-146/ portal https://atcoder.jp/contests/arc146 https://www.cnblogs.com/legendstane/p/16609911.html Problem E. Simple Speed To count, ask how many sequences of integers are there that satisfy the following conditions: 1. Each number occurs exactly Ai. 2. The absolute value of the difference between adjacent positions is exactly 1. Personally I think this dp is very elegant! First do not …

AtCoder Regular Contest 146 Read More »

AtCoder Beginner Contest 264

Original link: https://www.shuizilong.com/house/archives/atcoder-beginner-contest-264/ portal https://atcoder.jp/contests/abc264 Table of Contents portal Problem E. Blackout 2 Problem F. Monochromatic Path Problem G. String Fair Problem Ex. Perfect Binary Tree Problem E. Blackout 2 The practice of flashback and collection after offline is obvious. Not sure if it’s online. . . – https://twitter.com/kyopro_friends/status/1558460630847594496 Problem F. Monochromatic Path During the …

AtCoder Beginner Contest 264 Read More »

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.

BZOJ 3265. Volunteer Recruitment Enhanced Edition

Original link: https://www.shuizilong.com/house/archives/bzoj-3265-%E5%BF%97%E6%84%BF%E8%80%85%E6%8B%9B%E5%8B% 9F%E5%8A%A0%E5%BC%BA%E7%89%88/ https://darkbzoj.cc/problem/3265 https://blog.bill.moe/NOI2008-volunteer-advanced/ Classic error. . . Because the fully unimodular matrix is ​​destroyed, linear programming cannot guarantee integer solutions. . . The answer is not LL = =. const int N = int(1e4) + 9, M = int(1e3) + 9; struct Simplex { DB a[N][M]; int n, m; void pivot(int in, …

BZOJ 3265. Volunteer Recruitment Enhanced Edition Read More »