Qingyu的博客

博客

Tags
None

来自 HY 大神的提醒:注意账户安全,FTP 密码已重置

2021-05-11 12:20:33 By Qingyu

为了避免自己的账户泄露,建议不要在大机房中使用浏览器的“保存密码”功能!!

若认为自己的密码已经泄露,需要在修改密码后使用 登出所有活跃会话 功能,否则此前认证过的会话可能不会失效。

同时,为了避免权限组的题目泄露,hydd 大神指示各位 hy 的粉丝 使用强度较高的密码,请不要使用诸如 12345611451419260817hyakctsilovechino 的弱口令。

FTP 所有账户已重置,请有 FTP 权限的群友查看系统消息获取最新的用户密码。对于 Archive 中一些公开的测试数据,建议大家转至 Google Drive 镜像进行下载。

不建议在博客中写模拟赛题的题解,如果需要写内部题的题解,一定注意添加权限。所有内部题目的讨论博客需要拥有 access-secret-blogs 权限与校内团队(目前有 $12,16,17,19,22$ 五个团队)权限才可以查看。

本公告的最终解释权归 hydd 所有。

Discovery Hailiang Teams

2021-03-01 07:09:20 By Qingyu

Discovery Hailiang Logins

这个东西在若干个群友监督下随机生成的,他们都表示直接通过!

随机生成器是 @Qingyu 瞎写的,有问题就喷他.

在随机现场的 @hydd, @Lenstar 表示这个真的是一次随机生成的.

Login Member 1 Member 2 Member 3
hailiang01 房俊哲 张涵硕 郭思博
hailiang02 贾皓博 楼元培 刘成果
hailiang03 杨久知 徐锐扬 赖可依
hailiang04 蒋帅泉 郑杞珩 胡昊
hailiang05 王鸿翼 时庆钰 潘大卫
hailiang06 姜圻圣 徐子恩 毛艺婷

Yandex Contest 比赛合集

2021-02-20 00:10:12 By Qingyu

因为一些原因去随便找了个爬虫爬了下来所有比赛名称。

下面是部分内容展示,完整版请见附件下载:

Part I: contest.yandex.ru

最后更新:2021.02.19,更新至比赛 id 25209

Название URL
Sample Contest https://contest.yandex.ru/contest/3/enter/
Admin Requests https://contest.yandex.ru/contest/4/enter/
Test Contest #1 - Eternal https://contest.yandex.ru/contest/5/enter/
713 https://contest.yandex.ru/contest/6/enter/
Open Cup in Programming 2008-2009. Round 7. Northern Grand Prix. High division. https://contest.yandex.ru/contest/7/enter/
Contest #187 - Jury Session https://contest.yandex.ru/contest/8/enter/
Ural SU Contest (Petrozavodsk Summer, 2008) https://contest.yandex.ru/contest/9/enter/
Contest #1326 - Jury Session https://contest.yandex.ru/contest/10/enter/
Rocky Mountain SF 2011 https://contest.yandex.ru/contest/11/enter/
Contest 6125 - Jury Session https://contest.yandex.ru/contest/12/enter/
ECNA 2011 https://contest.yandex.ru/contest/13/enter/
ECNA11 - Jury Session https://contest.yandex.ru/contest/14/enter/
Petrozavodsk Training Camp - 2008. Belarusian SU + Kazakhstan Contest https://contest.yandex.ru/contest/15/enter/
CTU Open 2011 https://contest.yandex.ru/contest/17/enter/
CTU Open 2011 - Jury Session https://contest.yandex.ru/contest/18/enter/
Unpredictable Contest 1 - Petrozavodsk Summer, 2008 https://contest.yandex.ru/contest/19/enter/
Unpredictable Contest 1 - Jury Session https://contest.yandex.ru/contest/20/enter/
Petrozavodsk SU WX Contest - Petrozavodsk Summer, 2008 https://contest.yandex.ru/contest/21/enter/
Petrozavodsk SU WX Contest - Jury Session https://contest.yandex.ru/contest/22/enter/
Petrazavodsk 2008, Japanese Contest https://contest.yandex.ru/contest/23/enter/
Andrew Stankevich Contest 18 https://contest.yandex.ru/contest/29/enter/
PTZ 2009, Japanese Contest https://contest.yandex.ru/contest/30/enter/
ACM World Finals 2002 https://contest.yandex.ru/contest/31/enter/
PTZ 2009, day 5 https://contest.yandex.ru/contest/32/enter/
PTZ 2009, day 2 https://contest.yandex.ru/contest/33/enter/
PTZ 2009, day 8 https://contest.yandex.ru/contest/35/enter/
World Finals 2004 https://contest.yandex.ru/contest/36/enter/
World Finals 2005 https://contest.yandex.ru/contest/39/enter/
World Finals 2007 https://contest.yandex.ru/contest/40/enter/
World Finals 2007 (With Standings) https://contest.yandex.ru/contest/41/enter/
ASC, 2009 OpenCup Onsite https://contest.yandex.ru/contest/42/enter/
South Eastern USA https://contest.yandex.ru/contest/43/enter/
PTZ 2009, Ufa tour https://contest.yandex.ru/contest/44/enter/
PTZ2009, ASC 35 https://contest.yandex.ru/contest/45/enter/
Archive https://contest.yandex.ru/contest/46/enter/
Blitz (26 problems) https://contest.yandex.ru/contest/48/enter/
MIPT training camp individual contest 1 https://contest.yandex.ru/contest/53/enter/
ICL Individual Contest virtual https://contest.yandex.ru/contest/54/enter/
MIPT training camp individual contest 2 https://contest.yandex.ru/contest/55/enter/
MIPT Virtual https://contest.yandex.ru/contest/56/enter/
MIPT Virtual 2 https://contest.yandex.ru/contest/57/enter/
A+B Virtual https://contest.yandex.ru/contest/59/enter/
CPR Beta 1 https://contest.yandex.ru/contest/60/enter/
TRGI Day-1 https://contest.yandex.ru/contest/61/enter/
TRGI Day-2 https://contest.yandex.ru/contest/62/enter/
TRGI Day-3 https://contest.yandex.ru/contest/63/enter/
Mirror of XI Open Cup Onsite https://contest.yandex.ru/contest/64/enter/
Moscow Subregional 2006 https://contest.yandex.ru/contest/65/enter/
Moscow Subregional 2008 https://contest.yandex.ru/contest/68/enter/
Moscow Subregional - 2009 https://contest.yandex.ru/contest/72/enter/
Computer Science Center, 1 семестр, упражнения https://contest.yandex.ru/contest/74/enter/
Northern Subregional 2006 https://contest.yandex.ru/contest/75/enter/
Dummy https://contest.yandex.ru/contest/76/enter/
Д/з 3 - A* https://contest.yandex.ru/contest/77/enter/
Яндекс.Контест https://contest.yandex.ru/contest/79/enter/
Northern Subregional 2007 https://contest.yandex.ru/contest/81/enter/
Northern Subregional 2008 https://contest.yandex.ru/contest/84/enter/
SPbAU Homework 1 https://contest.yandex.ru/contest/85/enter/
Test contest for monitoring https://contest.yandex.ru/contest/87/enter/
Яндекс.Контест https://contest.yandex.ru/contest/88/enter/
SPbAU Theoretical Minimum https://contest.yandex.ru/contest/92/enter/
Northern Subregional 2009 https://contest.yandex.ru/contest/93/enter/
Western Subregional 2009 https://contest.yandex.ru/contest/94/enter/
Quarterfinal 1: Moscow-2012 https://contest.yandex.ru/contest/96/enter/
Quarterfinal 2: Western-2012 https://contest.yandex.ru/contest/97/enter/
Quarterfinal 3: Northern-2012 https://contest.yandex.ru/contest/98/enter/
SPbAU Homework 2 https://contest.yandex.ru/contest/99/enter/
Яндекс.Контест https://contest.yandex.ru/contest/102/enter/
Computer Science Center, 1 семестр, домашнее задание https://contest.yandex.ru/contest/103/enter/
Семинар 19.10.12 - Алгоритмы на графах https://contest.yandex.ru/contest/105/enter/
Central Subregional 2012 https://contest.yandex.ru/contest/110/enter/
Southern Subregional 2012 https://contest.yandex.ru/contest/111/enter/
SPbAU Aftersolving https://contest.yandex.ru/contest/112/enter/
Eastern Subregional 2012 https://contest.yandex.ru/contest/113/enter/
WQF12-Pre https://contest.yandex.ru/contest/114/enter/
Д/з 5 - Биномиальная куча https://contest.yandex.ru/contest/115/enter/
Д/з 6 - Максимальный поток https://contest.yandex.ru/contest/116/enter/
Яндекс.Контест https://contest.yandex.ru/contest/117/enter/
Д/з 7 - Дерево Фенвика https://contest.yandex.ru/contest/119/enter/
BAPC 2012 https://contest.yandex.ru/contest/120/enter/
Northern Subregional MIPT Run https://contest.yandex.ru/contest/121/enter/
All-Siberian Olympiad 2008, Day 2 https://contest.yandex.ru/contest/122/enter/
NCPC 2012 https://contest.yandex.ru/contest/123/enter/
MIPT Training Camp Entry Contest: CTU Open 2012 https://contest.yandex.ru/contest/124/enter/
Д/з 8 - Дерево отрезков + LCA + RMQ https://contest.yandex.ru/contest/125/enter/
Rocky Mountain Regional 2012 https://contest.yandex.ru/contest/126/enter/
MIPT Training camp team blitz 1 (12.11.2012) https://contest.yandex.ru/contest/128/enter/
MIPT Training camp team PTZ Selection 1 (13.11.2012) https://contest.yandex.ru/contest/129/enter/
MIPT Training camp team short contest 1 (12.11.2012) https://contest.yandex.ru/contest/130/enter/
MIPT Training camp team blitz 2 (13.11.2012) https://contest.yandex.ru/contest/131/enter/
Д/з 9 - Декартово дерево https://contest.yandex.ru/contest/132/enter/
MIPT Training camp 3D Contest (14.11.2012) https://contest.yandex.ru/contest/133/enter/
Яндекс.Контест https://contest.yandex.ru/contest/134/enter/
MIPT Training camp personal contest https://contest.yandex.ru/contest/135/enter/
MIPT Training camp 2D contest (15.11.2012) https://contest.yandex.ru/contest/136/enter/
MIPT Training camp Graph contest (16.11.2012) https://contest.yandex.ru/contest/137/enter/
MIPT Training camp short contest 2 (17.11.2012) https://contest.yandex.ru/contest/139/enter/
MIPT Training camp Math contest (17.11.2012) https://contest.yandex.ru/contest/141/enter/
MIPT Training camp Final Contest 1 (18.11.2012) https://contest.yandex.ru/contest/143/enter/
MIPT Training camp Final contest 2 (19.11.2012) https://contest.yandex.ru/contest/144/enter/

……

下载附件

迁移

2020-10-13 19:29:37 By Qingyu

不写了

XXI Open Cup 新闻合集

2020-09-29 15:47:48 By Qingyu

本帖所有内容均来自 Open Cup News 频道(https://t.me/opencup_ru), 若信息有冲突请以频道内容为准.

本帖所提及的发帖时间均指莫斯科时间 (UTC +3)

  • 05/27/2020 18:48: The rules for the next season will be adjusted soon, so stay tuned
  • 09/24/2020 13:03: The next season starts with GP of Eurasia at the Sep 27, followed by some GP based on one of Petrozavodsk problemsets in a week and the GP of Korea in two weeks.
  • 09/25/2020 14:24: New changes in the OpenCup rules are coming. First, there will be no Div 1 Yandex Sponsor Championship for NERC ICPC teams this year. Second: the team with participant who is author or tester of the some Grand Prix, earns the team's season average score for this Grand Prix (note that this value changes through whole season and will be finalized only at the season ends). Third: there may be some changes in team formation rule, those changes are under consideration
  • 10/26/2020 14:24: GP of Siberia will be held at the Nov 1, GP of Weihai at the Nov 8. As for Nov 15, there still no decision if there will be any Grand Prix.
  • 11/26/2020 04:08: GP of NorthBeach (aka GP of Bei Sha Tan) will be held at the Nov 29.
  • 12/14/2020 11:09: GP of Xiaomi will be held at the Dec 20. For the teams participated in the MW results from MW will be integrated.. Usual time. The early participation hopefully will be opened very soon.
  • 12/24/2020 02:04: GP of Samara will be held at the Jan 3. 2021. For the teams participated in the MW results from MW will be integrated. Usual time. The early participation will be opened
  • 12/24/2020 02:11: No GP is planned for Dec 27 due to intersection with AtCoder event
  • 01/09/2021 18:24: GP of Nanjing will be held on Jan 10 (tomorrow)
  • 01/28/2021 23:48: GP of Krakow will be held on Jan 31, usual time. For the Petrozavodsk camp teams the camp participation will count
  • 01/28/2021 23:49: Feb 7 and Feb 14 here will be GP too, based on Petrozavodsk contests. Names of the GP will be announced later
  • 01/29/2021 10:30: GP of Nizhny Novgorod will be held on Feb 7, usual time. For the Petrozavodsk camp teams and ICPC/Shanghai Training camp teams the camp participation will count.
  • 02/06/2021 17:03: GP of Belarus will be held on Feb 14, usual time. For the Petrozavodsk camp teams the camp participation will count
  • 02/06/2021 17:04: GP of Suwon will be held on Feb 21, usual time. For the Petrozavodsk camp teams the camp participation will count
  • 02/25/2021 04:12: GP of Tokyo will be held on Feb 28, usual time.
  • 04/23/2021 23:18: GP of China will be held on May 2, usual time. For the MW teams the camp participation will count
  • 05/03/2021 21:43: GP of Urals will be held on May 9, usual time. Ural championship onsite teams results will be counted
  • 05/03/2021 21:44: With good chances there will be two GP at May 16 and May 23, names and other details will be told at short time
  • 05/06/2021 14:11: The GP at May 16 is cancelled. GP of Southern Europe will be held on May 23, usual time.
  • 05/16/2021 21:15: Due to SEERC is moved from Sat to Sun, the GP of Southern Europe will start at 16:00 Moscow time (5 hours later than the standard time). The ext teams link appears approximatelly at the standard time or hour later.
  • 05/16/2021 21:16: Today the final contest for the XX Open Cup was held online. The winner is USA1, the runner-up is Past Glory, third place goes to Polish Mafia. Congratultations to the winners!
  • 05/23/2021 11:06: The ext teams may start the GP of Southeastern Europe from now. The link for the GP of Southeastern Europe is http://official.contest.yandex.com/opencupXXI/contest/27619/enter
  • 06/02/2021 17:21: GP of Beijing will be held on June 6, usual time, on the CCPC Finals tasks

本帖最后更新于 06/03/2021 09:58 (UTC +3)

Easy Contest Tutorial

2020-07-10 16:04:03 By Qingyu

A

把所有形如$(a,ka)$的路径提出来,共有$O(n\log n)$条路径,后面将这种路径称为限制。

考虑答案路径如果要不合法,那么必然覆盖了至少一条完整的限制。

考虑覆盖限制$(u,v)$的路径$(a,b)$,设$dfn_x$表示$x$的$dfs$序,$end_x$表示$x$的子树中最大的$dfs$序,不妨设$dfn_u < dfn_v,dfn_a < dfn_b$。

  1. 当$u$是$v$的祖先的时候,考虑$g$是离$u$最近的路径$(u,v)$上的点,要么$dfn_a < dfn_g,dfn_v\leq dfn_b\leq end_v$,要么$dfn_v\leq dfn_a\leq end_v,dfn_b>end_g$。
  2. 当$u$不是$v$的祖先的时候,显然$dfn_u\leq dfn_a\leq end_u, dfn_v\leq dfn_b\leq end_v$。

第一种情况构成了$2$个矩形,第二种情况构成了$1$个矩形。

最终我们只要求出所有矩形的并然后取个反即可,扫描线$+$线段树,总复杂度$O(n\log^2 n)$。

B

观察一下可以发现,如果将同一行与同一列的$1$用边连起来,一种方案可以拆成很多个环,从这个方面入手。

设$f_n$表示$n\times n$矩阵的答案,我们枚举第一行所在环的大小,那么有递推式: $$f_n = \sum_{i = 2}^{n}A_i\cdot \binom{n}{i}\cdot \binom{n - 1}{i - 1}\cdot f_{n - i}$$

其中$A_i$表示$i\times i$的矩阵只有一个环的方案数,$\binom{n}{i}$表示选出$i$列,$\binom{n-1}{i-1}$表示选出除了第$1$行的剩下的$i-1$行。

先给出结论:$A_n = \frac{n!(n-1)!}{2}$,那么式子化成: $$f_n = \sum_{i = 2}^{n}\frac{i!(i-1)!}{2}\cdot \binom{n}{i}\cdot \binom{n - 1}{i - 1}\cdot f_{n - i}$$

将组合数拆开化简,得到: $$f_n = \frac{n!(n-1)!}{2}\sum_{i = 2}^{n}\frac{f_{n-i}}{((n-i)!)^2}$$

设$g_n = \frac{f_n}{(n!)^2}$,那么有: $$g_n = \frac{1}{2n}\sum_{i = 2}^{n}g_{n - i}$$

维护前缀和即可,复杂度$O(n)$。

现在考虑怎么证明$A_n = \frac{n!(n-1)!}{2}$。

先$n!$每行每列放一个$1$,设$p_i$表示第$i$行$1$的列编号。在$p_1$列放第二个$1$ 有$n-1$种方案,假设第二个$1$行号为$q_i$,那么接下来考虑$p_{q_i}$列,这列第二个$1$有$n-2$ 种放法,因为不能在此时返回第一行,再加上已有$2$个$1$的行不能再放$1$。接下来就是$n-3...$。除以二是因为这个过程的逆过程也被计算过了。

C

一眼费用流裸题,但是数据范围有点大,考虑动态维护流量。

设当前加入的点编号为$x$,因为深度是$O(\log n)$的,因此我们可以枚举$x$和$x$要到的点的LCA,对于当前LCA设为$g$,我们需要求出$g$往子树中走最小的代价使得可以流到一个还有剩余容量的点,设为$down_g$。注意子树中行走的代价可以根据每条边的流量正负来确定,因此要维护每条边的流量,其实就是手动维护网路流。我们需要求出$down_g+cost(x\rightarrow g)$中代价最小的那个,然后暴力维护每条边的流量即可。

复杂度$O(n\log n)$。

JSOI 2017 题目合集

2020-06-27 23:18:15 By Qingyu

似乎 BZOJ 挂了以后就没有地方有 JSOI 2017 的题目了,于是上传了一下。

Enjoy!

省选入门赛 题解

2020-05-15 08:20:07 By Qingyu

这篇博客可以公开,就公开了。

A

算法1

$O(2^n)$ 枚举一下每个点染成什么颜色,然后从底向上 确定每一个点的权值, 如果所有点的权值都 $\geq 0$,则这是一组合法解,输出 POSSIBLE 否则继续做。

若没有合法解,则输出 IMPOSSIBLE

时间复杂度 $O(n \cdot 2^n)$,期望得分 20 分。

算法2

可以考虑用树形 DP 来做。用 $f_{i,j}$ 表示 $i$ 的子树里和 $i$ 颜色不同的点的权值和为 $j$ 可不可行。 从底向上树形 DP 即可。

时间复杂度 $O(nv^3)$,期望得分 40 分。

算法3

因为这部分数据是一条链, 从底向上 dp 用 $f_{i,j}$ 表示是否存在一个合法方案满足上一个与 $i$ 颜色不同的节点是 $j$ 转移的时候, 对于 $i$ 号点 ,枚举上一个和它颜色相同的点 $k$ ,如果 $f_{i+1,k}=\mathsf{true}$ 且 $v_i\geq v_k$,那么这就是一种合法方案。

时间复杂度 $O(n^2)$,期望得分 20 分。

算法4

因为一个点的点权 $a$ 可以是 $\geq 0$ 的任意数,所以 $i$ 的子树里 (不包括 $i$),和 $i$ 颜色相同的点的权值和要 $\leq v_i$ ,那么显然权值和要越小越好 。 那么可以参考算法 2 ,此时不需要两维 dp 了,只需要用 $f_i$ 表示 $i$ 的子树里和 $i$ 颜色不同的点的权值和的最小值。 因为这部分数据里一个点的儿子最多只有 $16$ 个,可以用 $2^{16}$ 枚举每个儿子 $j$ 和 $i$ 的颜色是否相同,若相同,则它的贡献是 $v_j$,否则贡献是 $f_j$,然后更新一下 $f_i$,从底向上 DP 。 时间复杂度 $O(n \cdot 2^{16})$,期望得分 20 分。

算法5

算法 4 已经很接近标算了。 只需要把算法 4 中 $2^16$ 的 0,1 枚举改成背包即可。 时间复杂度 $O(nv)$,期望得分 100 分。

B

基础知识

https://en.wikipedia.org/wiki/Laplacian_matrix

Laplacian matrix for ''simple graphs''

Given a simple graph $G$ with $n$ vertices, its Laplacian matrix $L_{n \times n}$ is defined as

$$L = D - A$$

where $D$ is the degree matrix and $A$ is the adjacency matrix of the graph. Since $G$ is a simple graph, $A$ only contains 1s or 0s and its diagonal elements are all 0s.

In the case of directed graphs, either the indegree or outdegree might be used, depending on the application.

The elements of $L$ are given by

$$L_{i,j} := \begin{cases} \deg(v_i) & \mbox{if}\ i = j \\ -1 & \mbox{if}\ i \neq j\ \mbox{and}\ v_i \mbox{ is adjacent to } v_j \\ 0 & \mbox{otherwise} \end{cases} $$

where $\operatorname{deg}(v_i)$ is the degree of the vertex $i$.

Symmetric normalized Laplacian

The symmetric normalized Laplacian matrix is defined as:

$$L^\text{sym} := D^{-\frac{1}{2}} L D^{-\frac{1}{2}} = I - D^{-\frac{1}{2}} A D^{-\frac{1}{2}}$$

The elements of $L^\text{sym}$ are given by

$$L^\text{sym}_{i,j} := \begin{cases} 1 & \mbox{if } i = j \mbox{ and } \deg(v_i) \neq 0\\ -\frac{1}{\sqrt{\deg(v_i)\deg(v_j)}} & \mbox{if } i \neq j \mbox{ and } v_i \mbox{ is adjacent to } v_j \\ 0 & \mbox{otherwise}. \end{cases}$$

Random walk normalized Laplacian

The random-walk normalized Laplacian matrix is defined as:

$$L^\text{rw} := D^{-1}L = I - D^{-1}A$$

The elements of $L^\text{rw}$ are given by $$L^\text{rw}_{i,j} := \begin{cases} 1 & \mbox{if } i = j \mbox{ and } \deg(v_i) \neq 0\\ -\frac{1}{\deg(v_i)} & \mbox{if } i \neq j \mbox{ and } v_i \mbox{ is adjacent to } v_j \\ 0 & \mbox{otherwise}. \end{cases}$$

Generalized Laplacian

The generalized Laplacian $Q$ is defined as:

$$\begin{cases} Q_{i,j} < 0 & \mbox{if } i \neq j \mbox{ and } v_i \mbox{ is adjacent to } v_j\\ Q_{i,j} = 0 & \mbox{if } i \neq j \mbox{ and } v_i \mbox{ is not adjacent to } v_j \\ \mbox{any number} & \mbox{otherwise}. \end{cases}$$

Notice the ordinary Laplacian is a generalized Laplacian.

Adjugate matrix

The adjugate matrix $\operatorname{adj}(A)$ is the transpose of the matrix of the cofactors, that is, : $(\operatorname{adj}(A))_{ij} = (-1)^{i+j} M_{ji}.$

For every matrix, one has

$$(\det A) I = A\operatorname{adj}A = (\operatorname{adj}A)\,A. $$

Thus the adjugate matrix can be used for expressing the inverse of a [[nonsingular matrix]]:

$$A^{-1} = \frac 1{\det A}\operatorname{adj}A. $$

暴力:

60 分做法:我们只需要枚举每条边,看看这条边出现在多少个树形图中,将这个值乘上边权,累加就是答案了。

如何求这条边在多少个树形图中呢?可以用补集转换,先求出树形图的总数;然后将这条边从图上删去,即在矩阵上加加减减,求出树形图个数,两者相减就是我们所要的值。

每次求一遍行列式,效率为 $O(mn^3)$

标算

容易发现,求解的 $m$ 次行列式,每次只会修改矩阵某一行的两个值。运用简单的线性代数知识,可以求出基尔霍夫矩阵的伴随矩阵,就可以 $O(1)$ 计算行列式了!

至于伴随矩阵,可以求出逆矩阵,乘上行列式即可;至于逆矩阵, 和原矩阵一起消元就可以啦!$O(m+n^3)$

C

The lower bound on the number of groups if $k$ is odd is $\sum_{i=\frac{k+1}{2}}^k \binom ni$: all subsets of size at least $\frac{k+1}{2}$ have to belong to different groups. Similarly, if $k$ is even, the lower bound is $\frac{1}{2} \binom{n}{k/2} + \sum_{i=k/2+1}^k \binom ni$.

Note that $\binom ni \geq \binom {n}{k-i}$ when $i \geq k/2$. Hence, if we can match all subsets of size $i$ with subsets of size $k-i$ into non-intersecting pairs without common elements, we can achieve the lower bound.

Such a matching always exists when $i \ne k-i$, since the graph is bipartite and “regular” (not exactly, but all vertices in each part have equal degrees). When $k$ is even, the graph is not bipartite, but it turns out that forming $\left\lfloor \frac{1}{2}\binom{n}{k/2} \right\rfloor$ pairs of subsets of size $\frac k2$ is always possible for $n \leq 17$. Even though the graphs are huge, we can build them and try to find maximum matchings: using Kuhn’s algorithm for bipartite graphs, and using Edmonds’ blossom algorithm (or maybe Kuhn’s algorithm with hacks...) for non-bipartite graphs. Even though time complexity looks big, a greedy initialization already builds a huge part of the matching, and augmenting chains are very short on average too. You can try all possible test cases to make sure your solution is fast enough.

If you know a constructive way to build the matchings, or if you have a proof that an optimal matching of subsets of size $\frac k2$ for even $k$ always exists, please share!

上半年附加题合集

2020-04-24 19:44:10 By Qingyu

Archive I

Archive II

Archive III

Archive IV

Archive V

Archive VI

Archive VII

Archive VIII

Archive IX

Archive X

你OJ278的详细题解

2020-02-15 03:51:43 By Qingyu
共 44 篇博客
  • 1
  • 2
  • 3
  • 4
  • 5