首页 > 小红的区间修改(一)
头像 RogeAustine菜还爱玩
发表于 2025-11-30 07:49:04
#include <iostream> #include <utility> #include <set> #include <algorithm> #define ll long long using namespace std; // 使用lo 展开全文
头像 怎么不AC啊
发表于 2025-11-30 01:02:21
#include <bits/stdc++.h> using namespace std; class BIT { int n; std::vector<int> su; public: BIT(int n) : n(n), su(n + 1,0 展开全文
头像 小柠_
发表于 2025-11-30 00:26:53
用 set维护区间即可,易得答案为最大区间长度加一。注意用 set.lower_bound() 加速寻找。 #include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin. 展开全文
头像 quchen666
发表于 2025-11-30 13:06:06
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; const int N = 3e5+10; int a[N]; int tree[N]; int l 展开全文
头像 FoolBlade
发表于 2025-11-30 10:16:08
void solve(){ int q;cin>>q; int maxl=0; set<int> rec; auto find=[&](int l,int r){ auto eL=rec.lower_bound(l); 展开全文
头像 花碗
发表于 2025-11-30 23:50:52
根据题意简化成每段区间成功添加到集合后 最大的区间长度但如果按个遍历集合内每个元素 时间复杂度为$O_n$超时 借助set二分查找优化为$log(n)$后即可 #include <iostream> #include<algorithm> #include <set&g 展开全文
头像 iui2006x
发表于 2025-11-30 01:25:07
set和bit都有了,那我来份线段树吧 #include <bits/stdc++.h> using namespace std; struct node { int l, r, sum, lazy; }; vector<node> tree(1200050); 展开全文
头像 olone
发表于 2025-11-30 10:28:05
#include<iostream> using namespace std; const int N=3e5+5; int q,n; int l[N],r[N],tr[N]; inline int lowbit(int x){return x&-x;} inline 展开全文
头像 xiaowang5242
发表于 2025-11-30 16:29:25
直接线段树维护[L,R]中是否存在1即可 // @xiaowang5242 #include <bits/stdc++.h> using namespace std; using ll = long long; using lll = __int128_t; using db = lon 展开全文
头像 拾壹和宇航员
发表于 2025-11-30 22:42:18
#include <iostream> using namespace std; const int N=3e5,block=550; int a[N+block],bl[N+block]; bool b[block],ans[N+block]; int lb(int x){ retur 展开全文

等你来战

查看全部