上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 65 下一页
摘要: 原题链接 题解 好抽象啊!!! 大概思路就是把强连通分量看作一个点,然后在此基础上找入度为零的点 code #include<bits/stdc++.h> using namespace std; vector<int> G[205]; int in[205]={0};//代表强连通分量的入度 in 阅读全文
posted @ 2024-02-24 17:28 纯粹的 阅读(18) 评论(0) 推荐(0)
摘要: 原题链接 题解 一个节点的答案一定是最大父节点+1 code #include<bits/stdc++.h> using namespace std; int ans[100005]={0}; int in[100005]={0}; vector<int> G[100005]; struct uni 阅读全文
posted @ 2024-02-24 13:09 纯粹的 阅读(19) 评论(0) 推荐(0)
摘要: 原题链接 题解 对于原序列而言,如果第一个元素是最大值或最小值,那么l肯定不能落在这,由于r也不可能落在这,所以相当于这个元素被剔除了 那么对于区间 \([1,n]\) 的研究就等价于对 \([2,n]\) 的研究 由此可以推出之后的做法 code #include<bits/stdc++.h> u 阅读全文
posted @ 2024-02-24 01:46 纯粹的 阅读(25) 评论(0) 推荐(0)
摘要: 原题链接 题解 由于执行收获操作后所有数组清零,清零后的数组最快捷的加分方法是加一收获一,所以就是第一次加多少次 然后第一次加完最多收获 \(n\) 分,相当于清零后执行总共 \(2n\) 次 所以只需要判断第一次加 &[0,2n-1]& 次加后收获时能收获多少就行了 code,注意细节 #incl 阅读全文
posted @ 2024-02-23 16:05 纯粹的 阅读(15) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.暴力模拟 对每条边枚举(枚举之前先对边排序),然后对除去枚举边之外的边做并查集 code1: #include<bits/stdc++.h> using namespace std; struct unit { int x,y; }edge[5005]; bool cmp(uni 阅读全文
posted @ 2024-02-22 18:58 纯粹的 阅读(33) 评论(0) 推荐(0)
摘要: 原题链接 题解 一只青蛙 \(x\) 天来回跳 $\to $ 一只青蛙从左往右跳 \(2x\) 次 \(\to\) \(2x\) 只青蛙从左往右跳一次 规律:对于任意长度为 \(y\) 的区间,其区间和一定不小于 \(2x\) 证明过程请看题解区,非常优雅 upd: 如果想从起点跳到石头上,那么前y 阅读全文
posted @ 2024-02-21 01:44 纯粹的 阅读(118) 评论(0) 推荐(0)
摘要: 原题链接 题解 标准的线段树加上一点点题意转化,注意细节 code #define ll long long #include<bits/stdc++.h> using namespace std; ll tree[810000]; ll wait[810000]; inline void read 阅读全文
posted @ 2024-02-20 23:44 纯粹的 阅读(22) 评论(0) 推荐(0)
摘要: 原题链接 题解 区间修改+单点查询 对于一个点,查询的时候翻转的次数如果是奇数,是1,如果是偶数,是0 所以题目转变成对区间上的点加一,然后求单点的奇偶性 树状数组 对一串序列加1,相当于对其差分序列的 \([l]++,[r+1]--\) code #include<bits/stdc++.h> u 阅读全文
posted @ 2024-02-20 22:44 纯粹的 阅读(21) 评论(0) 推荐(0)
摘要: 原题链接 题解 多次单点修改加上多次区间查询 线段树 code #include<bits/stdc++.h> using namespace std; int tree[800005]={0}; int a[200005]={0}; void build(int node,int l,int r) 阅读全文
posted @ 2024-02-20 21:20 纯粹的 阅读(18) 评论(0) 推荐(0)
摘要: 原题链接 code #define ll long long #include<bits/stdc++.h> using namespace std; ll tree[410000]={0}; ll wait_mul[410000]={0}; ll wait_add[410000]={0}; ll 阅读全文
posted @ 2024-02-20 20:25 纯粹的 阅读(20) 评论(0) 推荐(0)
上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 65 下一页