题解problem matrix 1913

CF1329E Dreamoon Loves AA 题解

令 $p_0=0,m\leftarrow m+1,p_{m}=n,a_i=p_i-p_{i-1}$,设在 $(p_{i-1},p_i)$ 中有 $d_i-1$ 个 `B` 变成了 `A`,满足 $\sum_{i=1}^m(d_i-1)=k$,让 $k\leftarrow k+m$,这样 $d$ 需要 ......
题解 Dreamoon 1329E Loves 1329

ABC302Ex Ball Collector 题解

注意到当有那些 $(a_i,b_i)$ 是确定的时,答案就是将 $(a_i,b_i)$ 连边后每个连通块的 $\min(|V|,|E|)$ 之和。 那么这个东西用可撤销并查集维护即可。 ```cpp #include #include using namespace std; const int N ......
题解 Collector Ball ABC 302

题解 P9384【[THUPC 2023 决赛] 着色】

有趣的构造题! 不存在三元环或五元环颜色相同看起来很诈骗,不妨加强一下问题,使得不存在奇环颜色相同。也就是说,每种颜色构成一个二分图。 又发现颜色数 $10=\lceil\log_21000\rceil$,其中 $1000$ 是 $n$ 的上限。因此,我们可以自然地想到使用二进制位为 $0$ 或为 ......
题解 P9384 THUPC 9384 2023

题解 P9380【[THUPC 2023 决赛] 总投票数】

首先,若存在 $P_i=1$,那么 $K=1$。 否则,设小数点后位数为 $L$,则有 $K\le 10^L$。这是因为任意一个 $L$ 位小数,都显然可以通过一个整数除以 $10^L$ 得到。 于是枚举分母 $k\le 10^L$,枚举每个 $P_i$,找到与其最接近的 $\frac{x_i}{k ......
题解 P9380 THUPC 9380 2023

2023青岛市程序设计竞赛小学组题解

1.付钱 题目链接:https://www.luogu.com.cn/problem/U303904 代码: #include<bits/stdc++.h> #define ll long long using namespace std; int main(){ ll n;cin>>n; cout ......
小学组 题解 程序设计 小学 程序

第十届蓝桥杯c++b组国赛题解(还在持续更新中...)

### 试题A:平方序列 ![image](https://img2023.cnblogs.com/blog/3026527/202306/3026527-20230603155641408-1288751874.png) **解题思路:** >直接枚举一遍x的取值,然后按照题目给定的式子算出y,每 ......
蓝桥 题解 第十届

ABC215E 题解

## 前言 [题目传送门!](https://www.luogu.com.cn/problem/AT_abc215_e) [更好的阅读体验?](https://www.cnblogs.com/liangbowen/p/17454445.html) 萌萌 DP 题。 ## 思路 题目就是在说从 $a$ ......
题解 215E ABC 215

题解 Andeviking 开公司 (hard)

## problem 链接:https://ac.nowcoder.com/acm/contest/59248/J 来源:牛客网 Andeviking 受够了打工人的生活。为了体验一下老板的感觉,他准备自己开一家公司,而一个公司能够高效运转的前提是该公司有一个高效的财务系统。由于 Andevikin ......
题解 Andeviking 公司 hard

P1001 A+B Problem

## 题目描述 输入两个整数 $a, b$,输出它们的和($|a|,|b| \le {10}^9$)。 注意 1. Pascal 使用 `integer` 会爆掉哦! 2. 有负数哦! 3. C/C++ 的 main 函数必须是 `int` 类型,而且 C 最后要 `return 0`。这不仅... ......
Problem P1001 1001

道路翻修题解

## $\mathcal{Description}$ - 给定一张无向图,为每条边定向,定义每个点的价值为出度与入度之差的绝对值,求最大价值和。 - 对于 $40\%$ 的数据,$1\leq n,m\leq20$。 - 对于 $70\%$ 的数据,$1\leq n\leq17$。 - 对于 $90\ ......
题解 道路

CF1808E3 题解

## 题意 [传送门](https://www.luogu.com.cn/problem/CF1808E3) 求有多少包含 $n$ 位数码的 $k$ 进制数,满足存在一位数等于其他 $n-1$ 位数的总和模 $k$。 $1\le n\le 10^{18},1\le k\le 2000$。 ## 题解 ......
题解 1808E 1808 CF E3

P1545 [USACO04DEC] Dividing the Path G 题解

丢一发好理解又好写的线段树优化dp。 [题目传送门](https://www.luogu.com.cn/problem/P1545 "题目传送门") ### 简要题意 给定一个长为 $l$ 的线段,求出尽量少的不相交区间覆盖整段线段,要求题目给的所有子区间只被 $1$ 个区间覆盖。 ### 分析 显 ......
题解 Dividing P1545 USACO 1545

【题解】 P5904 [POI2014]HOT-Hotels 加强版

[传送门](https://www.luogu.com.cn/problem/P5904) ## 题意 给定一棵树,求树上存在多少个三元组 $(a,b,c)$,满足 $\operatorname{dis}(a,b)=\operatorname{dis}(a,c)=\operatorname{dis} ......
题解 HOT-Hotels Hotels P5904 5904

Maximum Strictly Increasing Cells in a Matrix

Maximum Strictly Increasing Cells in a Matrix Given a 1-indexed m x n integer matrix mat, you can select any cell in the matrix as your starting cell. ......
Increasing Strictly Maximum Matrix Cells

杂项题解

#### JOISC2017_J Abduction 2 由于权值较高的路不会被权值较低的路线影响,所以首先考虑将 $h+w$ 条边按照权值降序排序,再考虑应该的最优决策方案。 注意到每一条路都横跨原始的矩形,这样以出发点为中心向上下左右发散就会有 4 条边构成一个小矩形。 考虑维护这个矩形每条边的 ......
杂项 题解

abc275_f Erase Subarrays 题解

# [Erase Subarrays](https://vjudge.csgrandeur.cn/problem/AtCoder-abc275_f) ## 题意 有一个长度为 $n$ 的整数序列 $a$,你可以执行以下操作若干次(可以不执行): - 选择序列的一个子段,将子段中的每个数变为 $0$。 ......
题解 Subarrays Erase abc 275

P1001 A+B Problem

考虑只用位运算去解决。 $a+b$ 可以表示成 $(a\land b)+(a\vee b)$,即把共有的 $1$ 和独有的 $1$ 分开。 因为 $(a\land b)\in(a\vee b)$,所以可以将前者左移一位,后者异或上前者,和保持不变。 这样又回到了第一步,递归计算即可,边界条件为 $a ......
Problem P1001 1001

[ROI 2018] Innophone 题解

# [ROI 2018] Innophone > 看了半天网上仅有的一篇题解……才堪堪写出来 > > 不过在LOJ上看提交,全是 `KTT`,看得我瑟瑟发抖~~(不会~~ ## 题意翻译 在平面上有一些点,你需要在这个平面上任意确定一个点(不要求是给定的点),定义其贡献为 横坐标 $\times$ ......
题解 Innophone 2018 ROI

题解 - Luogu P3676 小清新数据结构题

点分树是什么/yiw 定义 $s_i$ 为 $i$ 子树内的权值和,默认 $1$ 为根 首先考虑没有换根的解法 考虑把点权变换转化为加上一个数,即 $val_{x}\leftarrow y$ 转化为 $val_{x}\leftarrow val_{x} + (y - val_{x})$ 定义这个加上 ......
题解 数据结构 结构 数据 Luogu

魔力屏障 (magic) 题解

魔力屏障 (magic) 【问题描述】 小 Z 生活在神奇的魔法大陆上。今天他的魔法老师给了它这样一个法阵作为它 的期末考试题目: 法阵由从左至右 n 道魔力屏障组成,每道屏障有一个临界值 a,如果它承受攻 击的魔力值 ≥ a,屏障将会破碎,它所承受的魔力攻击将在魔力值减半后(向下取 整)继续向右移 ......
题解 屏障 魔力 magic

[WC/CTS2023] 树据结构 题解

## 题目描述 作为一个熟练的 OI 选手,你对数据结构的各种题型早已轻车熟路,比赛中只要碰到数据结构题就能三下五除二轻松搞定。这一天,你翻开 OJ,看到了这道题: 给定 $n$ 个点的有根树,点编号为 $1, 2, \dots, n$,$1$ 为根。每条边上有一个 $1$ 至 $n - 1$ 的* ......
题解 结构 2023 CTS WC

airflow standalone problem fix: The webserver is already running under PID 3244

## problems with airflow standalone to start server with error: `The webserver is already running under PID 3244`. Try to list full server listening i ......
standalone webserver airflow problem already

解决 NVIDIA Windows has stopped this device because it has reported problems. (Code 43)

## 场景 1. 当跑需要使用GPU算力的一些项目时候,需要用到CUDA,确保电脑是具有独立显卡的机子,但是怎么也没法让代码中的torch跑在GPU上; 2. 点击任务管理器查看"性能"下的GPU选项,看到运行中的并非是独立显卡而是集成显卡; 3. 点击设备管理器,发现NVIDIA显卡左下角有感叹号 ......
has reported problems Windows because

uoj#593 新年的军队 题解

后天南大营,这个趣味**编程**(注意不是算法)整的人很慌,于是 Delov 在怂恿人写猪国杀。不好评价。 去年写猪国杀的时候我在干嘛来着?哦和 joke3579 加训多项式啊那没事了。他老是说这个题然而没补,现在我补一下。 感觉不如寄希望于微积分和离散数学能拼过一点人。虽然也就是民科水平。线性代数 ......
题解 军队 uoj 593

本篇华为 OD 题解(B 卷):统计监控、需要打开多少监控器

最近更新的博客 华为 od 2023 | 什么是华为 od,od 薪资待遇,od 机试题清单 https://dream.blog.csdn.net/article/details/128980730 华为 OD 机试真题大全,用 Python 解华为机试题 | 机试宝典 https://dream ......
监控器 题解 OD

AtCoder Beginner Contest 247 Ex Rearranging Problem

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc247_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc247/tasks/abc247_h "AtCoder 传送门") 考虑我们如何判定一 ......
Rearranging Beginner AtCoder Contest Problem

How to fix the problem that Raspberry Pi cannot use the root user for SSH login All In One

How to fix the problem that Raspberry Pi cannot use the root user for SSH login All In One 如何修复树莓派无法使用 root 用户进行 SSH 登录的问题 ......
Raspberry the problem cannot login

JOISC 2020 题解

##### JOISC2020 Day1 建筑装饰4 Building4 我们发现 $A$ 的个数是连续的,所以我们只需要 DP 出最大的 $A$ 的个数和最大的 $B$ 的个数,若两者都 $\ge n$ 那么就有解。然后再从后往前推出方案即可。 https://qoj.ac/submission/ ......
题解 JOISC 2020

abc275_e Sugoroku 4 题解

# [Sugoroku 4](https://vjudge.csgrandeur.cn/problem/AtCoder-abc275_e) ## 题意 有一行格子,编号为 $0, 1, \cdots n$,你站在 $0$ 号格子上。 你手上有一个转盘,转盘上写有数字 $1 \sim m$,每次转转盘 ......
题解 Sugoroku abc 275

abc274_d Robot Arms 2 题解

# [Robot Arms 2](https://vjudge.csgrandeur.cn/problem/AtCoder-abc274_d) ## 题意 有一个长度为 $n$ 的整数序列 $a$ 和两个整数 $x$ 与 $y$,你要在平面直角坐标系上放置 $n + 1$ 个点($p_1, p_2, ......
题解 Robot Arms abc 274