上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 65 下一页
摘要: 原题链接 题解 巧妙模拟题 1.\(n\leq 5000\) 所以可以暴力枚举k 2.把翻转的区间具象化,我们可以发现序列中值为 1 的地方覆盖了偶数个区间, 0 的地方覆盖率奇数个区间 所以我们遍历字符串的时候,在遇到的第一个0开始建立以其为左端点的区间,如果遇到 1 的区间覆盖数为奇数,那就再建 阅读全文
posted @ 2024-04-09 16:41 纯粹的 阅读(188) 评论(0) 推荐(0)
摘要: 原题链接 题解 明确每个变量的意义 code #include<bits/stdc++.h> #define ll long long using namespace std; ll a[200005]; int main() { ll t; cin>>t; while(t--) { map<ll, 阅读全文
posted @ 2024-04-09 15:00 纯粹的 阅读(65) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.设 \(f(i)\) 为 \([0,i]\) 区间内该有多少个数属于整数集 \(Z\) 则对于每一对输入的 \(x,y,c\) 都有 \(f[y]-f[x-1]>=c\) 而且 \(0<=f[i]-f[i-1]<=1\) 差分约束由此得来 又因为下标从零开始,而且我们需要建立超级 阅读全文
posted @ 2024-04-08 16:24 纯粹的 阅读(45) 评论(2) 推荐(1)
摘要: 原题链接 题解 本质上是做题,所以观察题目数据,很小,直接暴力遍历所有点走单源最短路 code #include<bits/stdc++.h> using namespace std; struct node { int x,val; bool operator<(const node&b) con 阅读全文
posted @ 2024-04-08 14:44 纯粹的 阅读(25) 评论(0) 推荐(0)
摘要: 原题链接 题解 令 \(f(x)\) 代表所有课的发布时间都小于等于x时的不愉快值之和,x越小,AB消耗越大,x越大,C消耗越大,所以感性的想象 \(f(x)\) 是一个下凹函数 然后就可以快乐三分了 code #define ll unsigned long long #include<bits/ 阅读全文
posted @ 2024-04-08 13:48 纯粹的 阅读(28) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.首先,\(F(x)\) 图像一定是 下凹的,怎么证明我也不知道,只是感觉是这样 2.既然是下凹的,那么一定有最小值,区间内找极大值/极小值可以用三分 B站有个视频直观地讲解了,一看便知 还有一些小细节,请看讨论区 code #include <bits/stdc++.h> usi 阅读全文
posted @ 2024-04-07 22:31 纯粹的 阅读(59) 评论(0) 推荐(0)
摘要: 原题链接 题解 朝合力方向位移一段距离,并逐渐减小这个位移距离,需要痛苦的调参 code #include<bits/stdc++.h> using namespace std; double x=0,y=0; struct node { double x,y,w; }pos[1005]; int 阅读全文
posted @ 2024-04-07 13:47 纯粹的 阅读(18) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.筛一筛就行 code #include<bits/stdc++.h> using namespace std; int heshu[1000006]={0},f[1000007]={0}; int main() { int n,m; cin>>n>>m; for(long lon 阅读全文
posted @ 2024-04-07 13:03 纯粹的 阅读(14) 评论(0) 推荐(0)
摘要: 原题链接 题解 正常暴力解法如下: #include<bits/stdc++.h> using namespace std; int a[150007]; int main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) cin>>a[i]; while( 阅读全文
posted @ 2024-04-06 21:30 纯粹的 阅读(14) 评论(0) 推荐(0)
摘要: 原题链接 题解 一个细节坑我好久 code #include<bits/stdc++.h> #define ll long long using namespace std; ll f[15][15]={0};//从最高位第i位数字为j时的数字里有多少windy数 ll solve(ll now) 阅读全文
posted @ 2024-04-06 19:58 纯粹的 阅读(16) 评论(0) 推荐(0)
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 65 下一页