线段459579152 zhuanlan atcoder

AtCoder Beginner Contest 311

AtCoder Beginner Contest 311 First ABC 思路:找到第一个a,b,c都出现的位置 #include<bits/stdc++.h> using namespace std; #define int long long //#define int __int128 t ......
Beginner AtCoder Contest 311

线段树合并学习笔记

## 线段树合并 ### 过程: 顾名思义,线段树合并是指建立一棵新的线段树,这棵线段树的每个节点都是两棵原线段树对应节点合并后的结果。它常常被用于维护树上或是图上的信息。 一般每个点建一棵线段树,以子树或者题目要求进行合并(比如连通块)。 ### 实现: 我们考虑每次递归合并。把线段树 $b$ 上 ......
线段 笔记

AtCoder Beginner Contest 311

# A - First ABC ```cpp #include using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nu ......
Beginner AtCoder Contest 311

AtCoder Grand Contest 040 E Prefix Suffix Addition

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc040_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc040/tasks/agc040_e "AtCoder 传送门") 比较神奇的题。 考 ......
Addition AtCoder Contest Prefix Suffix

学不会的线段树

#前言(胡言乱语) “杭电杯”被狠狠薄纱😭😭😭,发现队友都是大佬,只有我是蒟蒻!!!具体表现为~~(包括但不限于)~~只有我还不会线段树😭,狠狠泪目!这就学🥀(・_・; #线段树的概念 [线段树(Segment Tree)](https://baike.baidu.com/item/%E7 ......
线段

Toyota Programming Contest 2023#4(AtCoder Beginner Contest 311)

# Toyota Programming Contest 2023#4(AtCoder Beginner Contest 311) ## [A - First ABC (atcoder.jp)](https://atcoder.jp/contests/abc311/tasks/abc311_a) * ......
Contest Programming Beginner AtCoder Toyota

Atcoder ARC058E Iroha and Haiku

题目中的式子转化一下即存在一位 $i$ 使得到 $i$ 时的后缀和存在 $X + Y + Z, Y + Z, Z$,再发现 $X + Y + Z\le 17$,考虑状压。 设 $f_{i, j}$ 为填了 $i$ 个数当前后缀和中存在的数的状态为 $j$(只存 $0\sim X + Y + Z$ 的 ......
Atcoder Iroha Haiku 058E ARC

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 传送门") 考虑一维怎么做。 ......
Beginner AtCoder Contest More Grid

Atcoder ABC311F Yet Another Grid Task

发现 $(i, j)$ 若为黑色则就会有一个 $(i, j)$ 为最高点的阶梯形的图形被染黑(阶梯形指对于 $1\le i\le x$ 第 $i$ 列第 $x - i + 1$ 行及以下都是黑色)。 那么能发现其实每个列只需要记录最高的黑色点行数即可,因为及其以下的点肯定都是黑色。 考虑设 $f_{ ......
Atcoder Another 311F Grid Task

Atcoder ABC311G One More Grid Task

可以想到枚举最小值同时算出包含其的最大矩阵和。 考虑枚举行的上下界,再枚举最小值然后求出最大的列的范围,因为 $a_{i, j}\ge 1$ 列的范围越广矩阵和也越大。 考虑如何算出列的范围,令第 $i$ 列在选中的行的范围内的最小值为 $mn_i$,则对于 $mn_i$ 的列 的范围 $[l, r ......
Atcoder 311G More Grid Task

「解题报告」Toyota Programming Contest 2023#4(AtCoder Beginner Contest 311)

比赛地址:[Toyota Programming Contest 2023#4(AtCoder Beginner Contest 311) - AtCoder](https://atcoder.jp/contests/abc311) 后记:大家都太强了%%%,如果我做不出第四题就要掉分了。。。 ## ......
Contest Programming Beginner AtCoder 报告

Atcoder ARC058B Iroha and a Grid

考虑从第 $b$ 列与第 $b + 1$ 之间分开这个矩阵,钦定 $(i, b)$ 下一步必须走到 $(i, b + 1)$,可以发现这样是不会漏算或算重的。 于是就可以用乘法原理算出这个 $i$ 的贡献:$\binom{(i - 1) + (b - 1)}{i - 1}\times \binom{ ......
Atcoder Iroha 058B Grid ARC

Toyota Programming Contest 2023#4(AtCoder Beginner Contest 311)——D

https://atcoder.jp/contests/abc311/tasks/abc311_d ## 思路 题目说如果当前方向的下一个点能走,那么就一直走,否则才能转向。根据题意模拟即可,这道题的难点在于,碰到已经走过的点到底要不要走。如果当前方向走到底,其中的点之前全部都走过那么就不能再走了。 ......
Contest Programming Beginner AtCoder Toyota

练习记录-AtCoder Beginner Contest 311-(A-E)

写的还挺顺的 F之后补 A - First ABC 找abc三个字母什么时候出现了一次 输出即可 B - Vacation Together 题意:最长的几个人一排里面均有时间 #include<bits/stdc++.h> #define close std::ios::sync_with_std ......
Beginner AtCoder Contest 311 A-E

P3352 [ZJOI2016] 线段树 思考--zhengjun

有一个显然的 $O(n^3q)$ 的做法: - 设 $f_{i,l,r,x}$ 表示 $i$ 次操作过后,区间 $[l,r]$ 的数 $\le x$,$a_{l-1},a_{r+1}>x$ 的方案数。 - 转移:$$f_{i,l,r,x}=f_{i-1,l,r,x}\times g_{l,r}+\s ......
线段 zhengjun P3352 3352 2016

AtCoder Beginner Contest 311

## **E - Defect-free Squares** >给你一个$n \times m$的方格矩阵,矩阵上有一些洞,然后让你求出所有的不含洞的正方形数量 > >$1 \leq n,m \leq 3000$ ### 题解:二维前缀和 + 二分答案 >* 我们先考虑一维上的问题,假设一维上有些位 ......
Beginner AtCoder Contest 311

AtCoder Beginner Contest 311 A-E题解

# A - First ABC ## 题意 给一个长度为N的仅由ABC三个字符组成的字符串S,问S中ABC三个字符第一次出现的位置的最大值。 ## 题解 使用`map`判重,记录当前不同的字符串的个数`cnt`,当`cnt`等于3时,输出此时的下标+1作为答案。 ## Code ```cpp #in ......
题解 Beginner AtCoder Contest 311

AtCoder Beginner Contest 311

## [A - First ABC (abc311 A)](https://atcoder.jp/contests/abc311/tasks/abc311_a) ### 题目大意 给定一个字符串,问最短的一个前缀,包含`A B C`这三个字符。 ### 解题思路 注意到这个前缀的末尾字母一定是这三个 ......
Beginner AtCoder Contest 311

线段树

//单点修改查询 //http://ybt.ssoier.cn:8088/problem_show.php?pid=1549 //https://www.luogu.com.cn/problem/P1198 //用一维数组来存,当作完全二叉树来存 #include<bits/stdc++.h> us ......
线段

【codevs3012】线段覆盖4

#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; struct hp{ int ai,bi,ci; }a[1005]; bool cmp(hp a,hp b){ ......
线段 codevs 3012

【模板】线段树优化建图

# 区间连区间 ### [luogu P6348 [PA2011] Journeys](https://www.luogu.com.cn/problem/P6348) 略带卡常 ```cpp #include using namespace std; vector>e[4200001]; int d ......
线段 模板

Atcoder Regular Contest 154 E - Reverse and Inversion

只要你发现是诈骗题就好办了。不要像我那样傻傻地瞪一个小时然后才发现那俩 sigma 里的东西相减是有性质的。 先考虑计算单个 $f(p)$,一眼的树状数组……吗?考虑最终答案式子里 $i$ 的系数:$\sum\limits_{jp_i]-\sum\limits_{j>i}[p_jp_i]+\sum\ ......
Inversion Atcoder Regular Contest Reverse

洛谷 P8861 - 线段

牛逼题。 先考虑 $l\le 10^5,10^5+1\le r$ 的部分分:一种方法是线段树,即因为左右端点是独立的,因此对左右端点各维护一个权值线段树表示有多少个区间以这个值为左 / 右端点,这样对于修改,左端点的部分相当于先查询 $\le l$ 的数的个数,然后将它们都挂到 $l$ 上,最后把 ......
线段 P8861 8861

Atcoder Regular Contest 124 E - Pass to Next

首先第一步是一个浅显的观察:我们要求的是**所有可能的最终序列的贡献之和**,如果能改为计算**所有操作序列的贡献之和**那问题会简单很多,并且我们惊奇地发现,如果一组 $x_i$ 全大于 $0$,那么把它们全减去 $1$ 以后得到的答案序列不会改变,而对于任意一种可能的最终序列,必然存在一组 $\ ......
Atcoder Regular Contest Pass Next

线段树--区间最大值模板

Smiling & Weeping 你是我绕过的山河错落,才找到的人间烟火 Problem Description There is a sequence a of length n. We use ai to denote the i-th element in this sequence. Yo ......
线段 最大值 区间 模板

「解题报告」freee Programming Contest 2023(AtCoder Beginner Contest 310)

比赛地址:[freee Programming Contest 2023(AtCoder Beginner Contest 310) - AtCoder](https://atcoder.jp/contests/abc310) 后记:原本写了比较详细的题解,但是,突发意外情况,它没了,所以这份题解略 ......
Contest Programming Beginner AtCoder 报告

线段树学习笔记

## 什么是线段树 线段树是一种分治思想的二叉树结构,用于在区间上进行信息维护与统计,与按照二进制进行区间划分的树状数组相比,线段树是一种更为通用的数据结构: 1. 线段树的每一个节点都代表一个区间。 2. 线段树有唯一的根节点,代表的区间是整个统计的范围。 3. 线段树的每一个叶子节点都代表一个长 ......
线段 笔记

Atcoder Grand Contest 057 D - Sum Avoidance

先来找些性质: - $A$ 中最小的元素 $M$ 肯定是最小的不是 $S$ 的因子的数,由于 $\text{lcm}(1,2,3,\cdots,43)>10^{18}$,所以 $M\le 43$。 - 对于每个 $0\le iS)break; for(int j=1;j>1; if(calc(mid ......
Avoidance Atcoder Contest Grand 057

线段树hdu-4027

Smiling & Weeping 倘若,我双手合十的愿望里有你呢 Problem Description A lot of battleships of evil are arranged in a line before the battle. Our commander decides to ......
线段 4027 hdu

AtCoder Grand Contest 049 E Increment Decrement

[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc049_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc049/tasks/agc049_e "AtCoder 传送门") 好题。同时考查了 ......
Decrement Increment AtCoder Contest Grand