222 g abc
Atcoder ABC259H Yet Another Path Counting
首先可以想到有组合数的方法: 令起点为 $(x1, y1)$,终点为 $(x2, y2)$,则路径方案数就为 $\binom{x2 + y2 - x1 - y1}{x2 - x1}$,这样设有 $k$ 个相同颜色的点,时间复杂度就为 $O(k^2)$。 再考虑到还有 $\text{DP}$ 方法: ......
AT_abc182_d 题解
[洛谷链接](https://www.luogu.com.cn/problem/AT_abc182_d)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/abc182_d) 本篇题解为此题**较简单做法**及**较少 ......
P9017 [USACO23JAN] Lights Off G 题解
## Description 给定正整数 $N$,和两个长为 $N$ 的 $01$ 序列 $a$ 和 $b$。定义一次操作为: 1. 将 $b$ 序列中的一个值翻转(即 $0$ 变成 $1$,$1$ 变成 $0$,下同)。 2. 对于 $b$ 序列中每个值为 $1$ 的位置,将 $a$ 序列中对应位 ......
G2023--最后一题(保存)
# 最后一题 题解 看完题后可以发现显然是树形dp。 先考虑没有 $k$ 限制的情况: 由于必须选 $\text{LCA}$,考虑状态与 $\text{LCA}$ 有关。 合法点的路径有两种情况: 1. 路径端点之一是 $\text{LCA}$; 1. 路径端点都不是 $\text{LCA}$。 再 ......
[ABC308G] Minimum Xor Pair Query 题解
[Minimum Xor Pair Query](https://www.luogu.com.cn/problem/AT_abc308_g) ### 题目大意 维护一个序列,支持动态插入,删除,查询最小异或对。 ### 思路分析 看到查询最小异或对首先想到 01Trie,但 01Trie 不支持删除 ......
AT_abc178_d 题解
[洛谷链接](https://www.luogu.com.cn/problem/AT_abc178_d)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/abc178_d) 本篇题解为此题较**简单做法**及**较少 ......
222
2023-07-26 10:56:49.908 StreamPark [streampark-build-pipeline-executor-18] ERROR o.a.s.c.c.w.WebSocketEndpoint:86 - No suitable encoder foundjavax.web ......
[ABC308G]MinimumXorPairQuery
# [[ABC308G] Minimum Xor Pair Query](https://www.luogu.com.cn/problem/AT_abc308_g) 必须知道的性质: > 对于三个非负整数 $x,y,z(x < y < z)$,有 $\min(x \bigoplus y,y\bigo ......
洛谷 P2894 [USACO08FEB] Hotel G 题解
题目链接 P2894 [USACO08FEB] Hotel G - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 分析 考虑用线段树维护区间信息 维护sum(最大连续空房间数) 如何合并? sum1为max(sum2,sum3)(1的两个子区间) 但我们发现若区间为100 001(0 ......
[ABC267F] Exactly K Steps题解
### [ABC267F] Exactly K Steps ### 题意 有一颗 $n$ 个点,$n - 1$ 条边的树,找到任意一个离结点 $u$ 的距离恰好为 $k$ 的点,或报告无解。 定义两点 $u, v$ 间的距离为这两个点之间的最短路径所包含的边数。 ### 思路 考虑无解,显然如果从 ......
[ABC311G] One More Grid Task
Problem StatementThere is an $N \times M$ grid, where the square at the $i$-th row from the top and $j$-th column from the left has a non-negative int ......
[ABC309G] Ban Permutation
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 ......
[ABC311G] One More Grid Task
# [ABC311G] One More Grid Task ## 题意 给一个矩阵,定义一个矩阵的价值为其最小值乘上总和,问子矩阵中最大价值。 ## 题解 感觉有些简单,不配在G这个位置。 观察贡献的形式,我们需要维护最小值与还有和。 首先第一个想法是以最小值为分治点来分治,划分区域。 但是对比一 ......
python使用ctypes调用gcc编译的dll之g++编译c++代码
### 1、在windows系统将cpp代码编译成可供python调用的dll #### 1.1 新建header.h代码如下 ```C++ #pragma once #define DllExport __declspec( dllexport ) extern "C" { DllExport v ......
AT_abc246_d 题解
[洛谷链接](https://www.luogu.com.cn/problem/AT_abc246_d)&[Atcoder 链接](https://atcoder.jp/contests/abc246/tasks/abc246_d) 本篇题解为此题较**简单做法**及**较少码量**,并且码风优良, ......
AT_abc218_d 题解
[洛谷链接](https://www.luogu.com.cn/problem/AT_abc218_d)&[Atcoder](https://atcoder.jp/contests/abc218/tasks/abc218_d) 本篇题解为此题较**简单做法**及**较少码量**,并且码风优良,请放心 ......
AT_abc215_d 题解
[洛谷链接](https://www.luogu.com.cn/problem/AT_abc215_d)&[Atcoder 链接](https://atcoder.jp/contests/abc215/tasks/abc215_d) 本篇题解为此题较**简单做法**及**较少码量**,并且码风优良, ......
Solution to AT_abc285_g Tatami
### Statement 请用若干个 $1 \times 1$ 和 $1 \times 2$ 的瓷砖(可以旋转)不重叠地完全覆盖 $H \times W$ 的长方形网格。第 $i$ 行第 $j$ 列的网格有字符 $c_{i,j}$,含义如下: - `1`:该网格只能用 $1 \times 1$ 的 ......
ABC311
## T1:[First ABC](https://atcoder.jp/contests/abc311/tasks/abc311_a "First ABC") 模拟 代码实现 ``` n = int(input()) s = input() A = B = C = False for i in r ......
AT_abc180_d 题解
[洛谷链接](https://www.luogu.com.cn/problem/AT_abc180_d)&[Atcoder 链接](https://atcoder.jp/contests/abc180/tasks/abc180_d) 本篇题解为此题较**简单做法**及**较少码量**,并且码风优良, ......
AtCoder Beginner Contest 311 G One More Grid Task
[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc311_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc311/tasks/abc311_g "AtCoder 传送门") 考虑一维怎么做。 ......
Atcoder ABC311F Yet Another Grid Task
发现 $(i, j)$ 若为黑色则就会有一个 $(i, j)$ 为最高点的阶梯形的图形被染黑(阶梯形指对于 $1\le i\le x$ 第 $i$ 列第 $x - i + 1$ 行及以下都是黑色)。 那么能发现其实每个列只需要记录最高的黑色点行数即可,因为及其以下的点肯定都是黑色。 考虑设 $f_{ ......
Atcoder ABC311G One More Grid Task
可以想到枚举最小值同时算出包含其的最大矩阵和。 考虑枚举行的上下界,再枚举最小值然后求出最大的列的范围,因为 $a_{i, j}\ge 1$ 列的范围越广矩阵和也越大。 考虑如何算出列的范围,令第 $i$ 列在选中的行的范围内的最小值为 $mn_i$,则对于 $mn_i$ 的列 的范围 $[l, r ......
ABC311 A~G
# $Atcoder$ $Beginner$ $Contest$ $311$ 首先,ABC题是个人都会,这里就不说了 其次,Ex我是人故我不会,这里也不说了 ## D MD读错一个题害的我瞪了好久好久。。。。 题意: 给定一个矩阵,其中有些是墙(边界也是),最初人在 $(2,2)$,每一次可以选择上 ......
ABC311 Solution
## [A - First ABC](https://atcoder.jp/contests/abc311/tasks/abc311_a) ### Sol 考虑使用三个 `bool` 记录当前 `A` , `B` , `C` 是否出现过,枚举判断即可。 ```cpp #include using n ......
ABC311(5)
ABC311 A. #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; typedef unsigned long long ULL; const int IN ......
ABC 311 A - E
# ABC 311 A - E ## A 题意:求一个字符串的第一个 `ABC` 最早出现的位置,可以打乱顺序,可以间隔 建立三个变量,然后以此判断即可,直到三种字符都出现就可以了 ## B 题意:给定每个人的行程表,有空和没空,求最多的连续的每个人都有空的天数 很简单,先 $ O(n^2) $ 求 ......
ABC 311 G
首先,我把英文 Editorial 翻译成人可以看的懂的英文 Editorial。(也许你还是看不懂。) Preface: solving this problem in a time complexity of about $300^3×log_2(300)≈2.2×10^8$ requires ......
ABC273F - Hammer 2
考虑区间 $dp$,我们只考虑那些涉及到新墙的步骤,所以先将所有墙和起点终点离散化,设 $dp_{l,r,x}$ 表示当前已经探索过 $[l,r]$,目前的人在最左端/最右端。 然后我们进行转移,一种转移是在当前方向转移,一种转移是往相反方向转移,转移代价都是目标和当前位置的差。 我们发现,$[l, ......
[ABC310G] Takahashi And Pass-The-Ball Game
Problem StatementThere are $N$ Takahashi. The $i$-th Takahashi has an integer $A_i$ and $B_i$ balls. An integer $x$ between $1$ and $K$, inclusive, wi ......