题解codeforces round 1805

Codeforces Round 886 (Div. 4)(A-H)

# A-To My Critics 读入 a,b,c 如果三个里较大的两个的和大于等于 10 输出 YES,不然输出 NO ``` #include using namespace std; void solve() { int a, b, c; cin >> a >> b >> c; cout = ......
Codeforces Round 886 A-H Div

Codeforces Round 886 (Div. 4)补题

# [Codeforces Round 886 (Div. 4)](https://codeforces.com/contest/1850) ## A~D: ```c++ //A: bool solve(){ cin>>a[1]>>a[2]>>a[3]; sort(a+1,a+4); return ......
Codeforces Round 886 Div

P1048 [NOIP2005 普及组] 采药 题解

## 思路 01背包模版题 转移方程为:```dp[j]=max(dp[j],dp[j-ti]+wi);//滚动数组优化``` # 代码 ```cpp #include #define ll long long #define ld long double using namespace std; ......
题解 P1048 1048 NOIP 2005

P1060 [NOIP2006 普及组] 开心的金明 题解

## 思路 ### 01背包模版题,唯一不同的是加了一个条件就是价格与重要度的乘积。 转移方程为:```dp[j]=max(dp[j],dp[j-w[i]]+w[i]*v[i]);``` 这里加了滚动数组优化。 ## 代码 ```cpp #include #define ll long long # ......
题解 P1060 1060 NOIP 2006

【大联盟】20230626 集查并(dsu) 题解 AT_toyota2023spring_final_g 【Git Gud】

【大联盟】20230626 集查并(dsu) 题解 AT_toyota2023spring_final_g 【Git Gud】 zyx /bx ## 题目描述 [here](https://atcoder.jp/contests/toyota2023spring-final/tasks/toyota ......

JOI2013 JOIOI の塔 (Tower of JOIOI)题解

# Description 给定一个由 `J`、`O`、`I` 组成的字符串,求最多能拆分成多少 `JOI` 或 `IOI`。 对于所有数据,$1\leq \vert S\vert\leq 10^6$。 # Solution 先处理出 $\text{pre}_i$ 为前缀 `J` 和 `I` 的数量 ......
题解 JOIOI Tower 2013 JOI

Codeforces Round 886 (Div. 4)

## F. We Were Both Children >![image-20230722103513062](https://zeoy-typora.oss-cn-hangzhou.aliyuncs.com/image-20230722103513062.png) ### 题解:约数 >* 我们先 ......
Codeforces Round 886 Div

Codeforces Round 886 (Div. 4)

Codeforces Round 886 (Div. 4) A - To My Critics 思路:最大的两个数的和大于等于10则YES #include<bits/stdc++.h> using namespace std; #define int long long typedef pair< ......
Codeforces Round 886 Div

【大联盟】20230703 T2 开心的序列(sequence) 题解 AT_agc049_f 【[AGC049F] Happy Sequence】

恐怖 zak 将这题加强,出到模拟赛。直接把 $A_i,B_i\le 10^5, C_i\le 5$ 变成了 $A_i,B_i,C_i\le 10^9$。 非常恐怖。 ## 题目描述 [here](https://www.luogu.com.cn/remoteJudgeRedirect/atcode ......
题解 大联盟 序列 049 20230703

「解题报告」Codeforces Round 886 (Div. 4)

比赛地址:[Dashboard - Codeforces Round 886 (Div. 4) - Codeforces](https://codeforces.com/contest/1850) 由于时间太晚了,因此并没有参加比赛,题目都是后来补做的。 ## A. To My Critics [P ......
Codeforces 报告 Round 886 Div

Codeforces 1456E - XOR-ranges

考虑一个 $L\le x\le R$ 的数 $x$,必然是一段前缀贴着 $L$ 或者 $R$,然后下一位脱离了 $L$ 和 $R$ 的限制,后面随便乱填。 注意到一个性质,对于某一位 $d$,考虑这一位上没有限制的那些位置,最优方案肯定是令其等于其左边(或者右边)第一个有限制的数的第 $d$ 位上的 ......
Codeforces XOR-ranges ranges 1456E 1456

Codeforces Round 886 (Div. 4)

# A. To My Critics ```cpp #include using namespace std; #define int long long void solve(){ vector a(3); for( auto & i : a ) cin >> i; sort( a.begin() ......
Codeforces Round 886 Div

2023.07.21 SMU Summer 2023 Contest Round 5

# 2023.07.21 [SMU Summer 2023 Contest Round 5](https://codeforces.com/group/L9GOcnr1dm/contest/459203) ## A. Points in Segments ~~~ 给n个,1~m的子集,求1~n中所有 ......
2023 Contest Summer Round SMU

Codeforces 1329E - Dreamoon Loves AA

思考下什么样的 $l,r$ 是合法的:显然对于一组长度为 $len$ 的空隙,要使得相邻两个 A 之间的距离在 $[l,r]$ 中,你新插入的 A 的个数应该位于 $[\lceil\dfrac{len}{r}\rceil-1,\lfloor\dfrac{len}{l}\rfloor-1]$ 中。因此 ......
Codeforces Dreamoon 1329E Loves 1329

【周考】Round8 2024.7.21

# T1 [方差](http://222.180.160.110:1024/contest/3917/problem/1) 观察式子:$\large\sum\limits_{i=1}^{N-1} \sum\limits_{j=i+1}^{N}\left|A_{i}-A_{j}\right|^{2}= ......
Round8 Round 2024 21

Luogu P4552 [Poetize6] IncDec Sequence 更好的题解

[原题链接](https://www.luogu.com.cn/problem/P4552 "原题链接") 第一步对于学过差分的人应该不难想 定义差分数组 $dis \quad s.t. \quad dis[i] = a[i] - a[i-1] $ 那么不难发现问题一只要让 $dis[2] ... ......
题解 Poetize6 Sequence Poetize IncDec

Codeforces 1830E - Bully Sort

这种题肯定首先要**寻找不变量**。 显然后面排好序的后缀不会被改变。因此从整体上来看我们的流程肯定是,如果当前 $p_n=n$,就令 $n$ 减一,否则你一步换的 $i$ 肯定满足 $p_i=n$。而显然 $\min\limits_{j=i}^np_j\le i$,因此我们考察 $\sum|i-p ......
Codeforces 1830E Bully 1830 Sort

2023 暑假集训模拟赛题解

[TOC] ## CSP 模拟 1 [来自学长的馈赠 2](https://www.cnblogs.com/CDOI-24374/p/16503427.html) . ## CSP 模拟 2 ### F 考虑 $x$ 只能在 $a_1\oplus b_i$ 里选,那么分别代入暴力检验即可 . 时间复 ......
模拟赛 题解 2023

幽灵乐团 题解

[幽灵乐团](https://www.luogu.com.cn/problem/P5518) ### 题目大意 $T$ 组数据,每组数据给定 $A,B,C$,求: $$\prod_{i=1}^A\prod_{j=1}^B\prod_{k=1}^C\Big(\frac{\text{lcm}(i,j)} ......
题解 幽灵 乐团

Codeforces 794G - Replace All

一个比较垃圾的做法,卡着时限过了这道题。 首先大胆猜个结论:要么 $|s|=|t|$,此时 $A,B$ 任取,要么存在字符串 $c$ 和整数 $x,y$ 使得 $A=c^x,B=c^y$,其中 $c^x$ 表示 $x$ 个 $c$ 拼接得到的结果。证明的话感觉还挺复杂的,可能要 border 引理之 ......
Codeforces Replace 794G 794 All

P9352 题解

[problem](https://www.luogu.com.cn/problem/P9352) & [blog](https://www.cnblogs.com/liangbowen/p/17571984.html)。 HerryHuang 的 DP 专题中最喜欢的一题,抢第一篇题解 /fend ......
题解 P9352 9352

SMU Summer 2023 Contest Round 5

# [SMU Summer 2023 Contest Round 5](https://codeforces.com/group/L9GOcnr1dm/contest/459203) ## [A. Points in Segments](https://codeforces.com/group/L9 ......
Contest Summer Round 2023 SMU

Codeforces 1662J - Training Camp

这种数据范围和题目特点一眼网络流。 对于一种选法,我们考虑建立两个黑白矩阵,如果一个点 $(i,j)$ 被选,我们就将第 $i$ 行中 $a_{i,k}\le a_{i,j}$ 的 $(i,k)$ 在第一张网格图中染成黑色,将第 $j$ 列中 $a_{k,j}\le a_{i,j}$ 的点 $(k, ......
Codeforces Training 1662J 1662 Camp

JOI2012 魚(Fish) 题解

# Description 给定 $n$ 条鱼,每条鱼有长度和颜色。你可以选出若干条鱼,需要满足最大长度小于最小长度的两倍。定义两种养鱼方案不同仅当它们三种颜色之一的出现次数不同,求不同的养鱼方案数。 对于 $100\%$ 的数据,$1\leq n\leq 5\times 10^5$。 题目链接:[ ......
题解 2012 Fish JOI

Codeforces Round 501 (Div. 3)

Codeforces Round 501 (Div. 3) A - Points in Segments 思路:记录每个区间 #include<bits/stdc++.h> using namespace std; #define int long long //#define int __int1 ......
Codeforces Round 501 Div

Codeforces 1470F - Strange Covering

一年前模拟赛的题,时隔恰好一年零一天又考了一遍还是不会做。 对两个矩形的位置分情况: 1. 相离,此时必然存在一条与 $x$ 轴或 $y$ 轴平行的分界线,满足一个矩形在左边(下面),另一个矩形在右边(上面)。这部分显然可以 $O(n)$ 地处理。 2. 相交成十字形。这一类我的处理比较烦:考虑预处 ......
Codeforces Covering Strange 1470F 1470

CF1846E2 Rudolf and Snowflakes (hard version) 题解

### Statement $T$ 次给定整数 $n$,判断是否存在 $q, k \ge 2$ 使得 $1 + q + q^2 + \cdots + q^k = n$。 $1 \le T \le {10^4}$,$1 \le n \le {10}^{18}$。 ### Solution 考虑弱化问题 ......
题解 Snowflakes version Rudolf 1846E

JOI2012 カンガルー(Kangaroo) 题解

# Description 有 $n$ 个套娃,每个套娃都有外体积与内体积,内体积严格小于外体积。你可以把一个娃套到另一个内体积比它的外体积大的娃里面,并且需要套到不能再套为止。求出有多少种套娃方案。 题目链接:[JOI](https://www2.ioi-jp.org/camp/2012/2012 ......
题解 Kangaroo 2012 JOI

P4843题解

# P4843题解 + [原题连接](https://www.luogu.com.cn/problem/P4843) ## 建模 一到比较裸的有源汇上下界最小流。每条边必走一次,要求求出最小的流量。由于比较裸,这里当作上下界流的例题讲。 ## 什么是有源汇上下界最小流 顾名思义,就是在最大流的基础上 ......
题解 P4843 4843

列队春游题解 O(n方)

## [题目](https://tg.hszxoj.com/contest/759/problem/8) ![](https://tg.hszxoj.com/images/210521_EXbyYYssXh.png) ## 前言 出生镇楼 [![](https://cdn.luogu.com.cn/ ......
题解