希胤
希胤
全部文章
题解
dp模板(4)
dp狂练(1)
图论模板(4)
小知识(3)
数论模板(1)
未归档(3)
杂模板(5)
归档
标签
去牛客网
登录
/
注册
希胤的博客
全部文章
/ 题解
(共40篇)
P1889 士兵站队
纵坐标:易知是中位数到各点距离之和最短 横坐标:设最终x1的位置为k+1,所以x2的位置为k+2 ... xn的位置为k+n 则各点的横向移动距离为 |x1-(k+1)|+|x2-(k+2)|+...+|xn-(k+n)| 变形 ==> |(x1-1)-...
2020-10-23
0
562
中心点(中位点)到其各个点的距离之和最短
题目: 输油管道问题(洛谷) 这道题是简单的中位数,经典的输油管道问题 此题是中位线到各个点的距离之和最短 #include<bits/stdc++.h> using namespace std; int const N=1e4+7; struct L{ int x,y; fr...
2020-10-23
0
643
map,第一个为关键字,第二个为键值
#include<bits/stdc++.h> using namespace std; int n; map<string,string>mp; //第一个为关键字,第二个为键值 int main(){ cin >> n; for(int i...
2020-10-11
0
687
字符串存大数
参考博客 #include<bits/stdc++.h> using namespace std; int k,len; string str; int main(){ cin >> str; cin >> k; len=str.size...
2020-10-10
0
442
STL(list)(双向链表)
参考博客 #include<bits/stdc++.h> using namespace std; int n,m; int const N=1e5+7; list<int>s; list<int>::iterator pos[N]; //用find会超时,...
2020-10-10
0
619
严格不相交的两条路径,要保证一个人一定在另一个人的右边
题目: P1006 传纸条 这题虽然跟方格取数很像,但是这题要求两个人的路径严格不相交减了两条枝,复杂度已经够优秀了 include<bits/stdc++.h> using namespace std;#define low(x) x&(-x)#define ll long ...
2020-10-06
0
437
错排的dp方程——f[i]=(i-1)*(f[i-1]+f[i-2])
include<bits/stdc++.h> using namespace std;namespace{ template<typename t=""> inline void read(T &s){ T f=1;s=0;char ch=g...
2020-10-02
0
532
map下标要用自定义类型时,要重载<
#include<bits stdc++.h> using namespace std; namespace{ template inline void read(T &s){ T f=1;s=0;char ch=getchar(); for(;!isdigit(ch);ch=g...
2020-09-30
0
554
二维前缀和,差分
include<bits/stdc++.h> using namespace std;namespace{ template<typename t=""> inline void read(T &s){ T f=1;s=0;char ch=g...
2020-09-30
0
579
滑动窗口和尺取法就是双指针,滑动窗口约等于尺取法
题目:日志统计(AcWing) 解析:本题的尺子长度为时间#include<bits/stdc++.h>using namespace std;namespace{ template<typename t=""> inline void read(T &s...
2020-09-12
0
542
首页
上一页
1
2
3
4
下一页
末页