随笔分类 -  Atcoder

摘要:题目链接 考虑最后形态,一定是有某一个区间 \([l,r]\) 保持初始的样子, \(l\) 前面都是 <,\(r\) 后面都是 >。 这个区间一定是某两个相邻圆点的位置。设 \(f_i\) 为前 \(i\) 个数全部被覆盖成 < 的概率。设 \(x\) 为 \(l\) 前面圆点的数量,\(y\) 阅读全文
posted @ 2023-12-12 12:50 灰鲭鲨 阅读(52) 评论(0) 推荐(0)
摘要:题解链接 非常厉害的一道题。 考虑无解是什么情况? R 的个数超过 \(2^{n-1}\) 先考虑如何判定。从前往后考虑,如果遇到一个 B,那么如果后面有 R,就选最靠前的 R,否则选最靠后的一个 B.如果遇到 R,就选最靠后的一个 B。 但是这个判定很繁琐。我们考虑求出一个合法序列,使得他的 B 阅读全文
posted @ 2023-12-12 12:36 灰鲭鲨 阅读(44) 评论(0) 推荐(0)
摘要:题目链接 好题。 如果 \(1\) 和 \(n\) 一直联通,开始即结束。 如果 \(n\mod 4=1\),那么 \(\frac 12x(x+1)+\frac12(n-x)(n-x+1)\) 为偶数。 如果 \(n\mod 4=3\),那么 \(\frac 12x(x+1)+\frac12(n-x 阅读全文
posted @ 2023-11-26 12:49 灰鲭鲨 阅读(24) 评论(0) 推荐(0)
摘要:题目链接 简化题意:有一个 \(n\) 个点的图,问有多少个长度为 \(M\) 的边序列,满足连边后图是二分图。 \(n\le 30,m\le 10^9\) 考虑先强制要求无重边。 定义 \(f_{i,j}\) 为 \(i\) 个点,\(j\) 条边的图的二分图染色数量(染色方式不同算多次)。这个是 阅读全文
posted @ 2023-11-26 12:35 灰鲭鲨 阅读(26) 评论(0) 推荐(0)
摘要:题目链接 看到严格选 \(k\) 个,不难想到 WQS二分。定义 \(f(x)\) 为分成 \(x\) 段,最多有多少个超过 \(S\) 的。然后你会发现他不是凸的。因为他有很多平段,比如把两个很小的合并不改变答案。 换个方向? 考虑定义 \(f(x)\) 为有 \(x\) 个超过 \(S\) 的段 阅读全文
posted @ 2023-11-26 11:59 灰鲭鲨 阅读(47) 评论(0) 推荐(0)
摘要:Problem StatementWe have a sequence of $N$ positive integers: $A_1,A_2,\cdots,A_N$. You are to rearrange these integers into another sequence $x_1,x_2 阅读全文
posted @ 2023-11-03 20:36 灰鲭鲨 阅读(32) 评论(0) 推荐(0)
摘要:Problem StatementThere are $2N$ integers written on a blackboard. The $i$-th integer is $A_i$. Alice and Bob will play a game consisting of $N$ rounds 阅读全文
posted @ 2023-11-03 20:27 灰鲭鲨 阅读(49) 评论(0) 推荐(0)
摘要:Problem StatementSnuke runs a bakery. He is planning for the next $N$ days. Let us call these days Day $1,2,\cdots,N$. At the moment, the bakery hires 阅读全文
posted @ 2023-09-25 11:10 灰鲭鲨 阅读(35) 评论(0) 推荐(0)
摘要:Problem StatementYou are given an integer sequence of length $N$: $A_1,A_2,...,A_N$. Let us perform $Q$ operations in order. The $i$-th operation is d 阅读全文
posted @ 2023-09-22 20:50 灰鲭鲨 阅读(37) 评论(0) 推荐(0)
摘要:Problem StatementThere is a tree with $N$ vertices numbered $1$ to $N$. The $i$-th edge connects vertices $A_i$ and $B_i$. Let us keep performing the 阅读全文
posted @ 2023-09-22 20:06 灰鲭鲨 阅读(53) 评论(0) 推荐(0)
摘要:Problem StatementFor an integer sequence $X=(X_1,X_2,\dots,X_n)$, let $X[L,R]$ denote the integer sequence $(X_L,X_{L+1},\dots,X_{R})$. You are given 阅读全文
posted @ 2023-09-22 19:56 灰鲭鲨 阅读(38) 评论(0) 推荐(0)
摘要:Problem StatementWe have a grid with $N$ rows and $M$ columns. We denote by $(i,j)$ the cell in the $i$-th row from the top and $j$-th column from the 阅读全文
posted @ 2023-09-22 19:35 灰鲭鲨 阅读(64) 评论(0) 推荐(0)
摘要:Problem StatementSnuke got positive integers $s_1,...,s_N$ from his mother, as a birthday present. There may be duplicate elements. He will circle som 阅读全文
posted @ 2023-09-09 16:09 灰鲭鲨 阅读(28) 评论(0) 推荐(0)
摘要:Problem StatementThere is a grid with $N$ rows and $M$ columns. The square at the $i$-th row from the top and the $j$-th column from the left contains 阅读全文
posted @ 2023-09-04 10:36 灰鲭鲨 阅读(68) 评论(0) 推荐(1)
摘要:Problem StatementYou are given a simple connected undirected graph $G$ with $N$ vertices and $M$ edges. The vertices and edges of $G$ are numbered as 阅读全文
posted @ 2023-09-04 10:28 灰鲭鲨 阅读(39) 评论(0) 推荐(0)
摘要:Problem StatementThere are $N$ cards numbered $1$ through $N$. Each face of a card has an integer written on it; card $i$ has $A_i$ on its front and $ 阅读全文
posted @ 2023-08-24 23:02 灰鲭鲨 阅读(27) 评论(0) 推荐(0)
摘要:Problem StatementThere are $2^N$ players, numbered $1, 2, ..., 2^N$. They decided to hold a tournament. The tournament proceeds as follows: Choose a p 阅读全文
posted @ 2023-08-03 20:21 灰鲭鲨 阅读(35) 评论(0) 推荐(0)
摘要:Problem StatementYou are given a set $S$ of strings consisting of 0 and 1, and an integer $K$. Find the longest string that is a subsequence of $K$ or 阅读全文
posted @ 2023-07-26 12:09 灰鲭鲨 阅读(30) 评论(0) 推荐(0)
摘要:Problem StatementWe have a sequence of positive integers of length $N^2$, $A=(A_1,\ A_2,\ \dots,\ A_{N^2})$, and a positive integer $S$. For this sequ 阅读全文
posted @ 2023-07-25 19:46 灰鲭鲨 阅读(36) 评论(0) 推荐(0)
摘要:Problem StatementFind the number, modulo $998244353$, of permutations $P=(P_1,P_2,\dots,P_N)$ of $(1,2,\dots,N)$ such that: $|P_i - i| \ge X$ for all 阅读全文
posted @ 2023-07-25 19:27 灰鲭鲨 阅读(42) 评论(0) 推荐(0)