题目链接: 2018 ICPC Pacific Northwest Regional Contest - I-Inversions 题意 给出一个长度为\(n\)的序列,其中的数字介于0-k之间,为0表示这个位置是空的.现在可以在这些空的位置上任意填入1-k之间的数字(可以重复).问最多可以总共有多少对逆序对.(如果\(i<j,p_i>p_j\),则称\((i,j)\)是一对逆序对) \(1\leq n\leq 2*10^5,\ 1\leq k\leq 100\) 思路 第一步,先证明最优的填…
题目:https://vj.69fa.cn/12703be72f729288b4cced17e2501850?v=1552995458 dp这个题目网上说是dp+离散化这个题目要对这些数字先处理然后进行dp,这个处理值得学习一下,就是把数字范围为1~1e9,转化成一个顺序列表,这个顺序列表每一个不同的位置含有不同的难度,dp[i][j]代表前面i种选出j种的方案数. #include <cstdio> #include <iostream> #include <cstdlib…
A. Radio Prize All boring tree-shaped lands are alike, while all exciting tree-shaped lands are exciting in their own special ways.What makes Treeland more exciting than the other tree-shaped lands are the raddest radio hosts in the local area: Roota…
2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) 思路: A Exam 思路:水题 代码: #include<bits/stdc++.h> using namespace std; int main(){ int k; scanf("%d",&k); ],s2[]; scanf("%s%s",s1,s2); ; int n=strlen(s1); ;i<n;i++)…
A:Alphabet Solved. 签. #include<bits/stdc++.h> using namespace std; ]; ]; int main(){ scanf(); ); ;i<=n;i++) { f[i]=; } ;i<=n;i++) { ;j<i;j++) { if(s[i]>s[j]){ f[i]=max(f[i],f[j]+); } } } ; ;i<=n;i++) { maxn=max(maxn,f[i]); } cout<&…
SurfNow that you've come to Florida and taken up surng, you love it! Of course, you've realized thatif you take a particular wave, even if it's very fun, you may miss another wave that's just aboutto come that's even more fun. Luckily, you've gotten…
比赛链接:Contest Setting C题 题意:$n$道题目,每道题目难度为$ai$,选择$k$道难度不同的题目,有多少种选择方案.$1<=k<=n<=1000,1<=ai<=10^9$ 题解:问题转化一下(map,离散化均可):m种难度,每种难度有bi道题目,每次从m种中选择k种,把对应的题目数量相乘,求总和. 列出$dp[i][j]$:表示前j个物品以j结尾选择i个的方案数:$sum[i][j]$:表示从1-j分别作为结尾选择i个的方案数总和. $dp[i][j]=…
[题目链接] A - Alphabet 最长公共子序列.保留最长公共子序列,剩余的删除或者补足即可. #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; char s[maxn]; char t[maxn]; int dp[100][100]; int main() { scanf("%s", s); for(int i = 0; i < 26; i ++) { t[i] =…
A:Exam Solved. 温暖的签. #include<bits/stdc++.h> using namespace std; ; int k; char str1[maxn], str2[maxn]; int main() { while(~scanf("%d",&k)) { scanf(); scanf(); , cnt2 = ; ); ; i <= len; ++i) { if(str1[i] == str2[i]) cnt1++; else cnt…
*感谢两位浙江大佬带我飞 贴下成绩 div2 div1 *div2不是我打的上个厕所就5/11了 比赛小结 A [题目大意] 有n(n<=500)个机场,两两之间距离是g[i][j],每经停一个机场需要p[i]的时间维修 有m条线路,描述为出发机场,终点机场,出发时间,求航空公司至少需要多少架飞机 每条航线必须直飞 但是转机的时候可以劲停多个机场 [题解] 首先一架飞机能在完成航线A后去飞航线B的条件很显然.就是 表示两点间最短路.那么我们可以用这个不等式把问题转化为最小路径覆盖问题 我想了下这…