A I'm bored with life

水题

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const LL N=1,M=1,MOD=1;int main()
{//freopen("t.txt","r",stdin);ios::sync_with_stdio(false);LL a,b;scanf("%I64d%I64d",&a,&b);LL c=min(a,b);LL ans=1;for(LL i=2;i<=c;i++) ans=ans*i;printf("%I64d\n",ans);return 0;
}

  

B Crossword solving

水题

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const LL N=1,M=1,MOD=1;int main()
{//freopen("t.txt","r",stdin);ios::sync_with_stdio(false);int n,m;char a[2000],b[2000];scanf("%d%d",&n,&m);scanf("%s%s",&b,&a);vector<int>pos;pos.resize(n+1);for(int i=0;i+n-1<m;i++){vector<int>pon;for(int j=0;j<n;j++){if(a[i+j]!=b[j])pon.push_back(j+1);}if(pon.size()<pos.size())pos=pon;}printf("%d\n",pos.size());for(int i=0;i<pos.size();i++){printf("%d ",pos[i]);}printf("\n");return 0;
}

  

C Hacker, pack your bags!

比较裸的线段树,Mdzz 一开始没用LL WA了好几发 线段树写的还不是很熟练。。 最后调出来没时间看后边的题了!!

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const LL N=200005,M=15000000,MOD=1;
LL L[N],R[N],C[N];
int rt1[N],rt2[N],lc[M],rc[M],sumc[M],tot;
int n,x;
void update(int cur)
{sumc[cur]=2e9+10;if(lc[cur]!=0)sumc[cur]=min(sumc[cur],sumc[lc[cur]]);if(rc[cur]!=0)sumc[cur]=min(sumc[cur],sumc[rc[cur]]);
}
void insert(int cur,int val,int cost,int l,int r)
{if(l==r&&l==val){if(sumc[cur]==0)sumc[cur]=cost;else sumc[cur]=min(sumc[cur],cost);return ;}int mid=(l+r)/2;if(val<=mid){if(lc[cur]==0)lc[cur]=++tot;insert(lc[cur],val,cost,l,mid);}else{if(rc[cur]==0)rc[cur]=++tot;insert(rc[cur],val,cost,mid+1,r);}update(cur);
}
LL que1(int cur,int vl,int vr,int l,int r)
{if(cur==0||r<vl||l>vr)return 2e9+10;if(r<=vr&&l>=vl)return sumc[cur];int mid=(l+r)/2;LL ret=2e9+10;if(vl<=mid)ret=min(ret, que1(lc[cur],vl,min(mid,vr),l,mid));if(vr>mid) ret=min( ret,que1(rc[cur],max(vl,mid+1),vr,mid+1,r));return ret;
}
int main()
{//freopen("t.txt","r",stdin);ios::sync_with_stdio(false);scanf("%d%d",&n,&x);for(int i=1;i<=n;i++){scanf("%I64d%I64d%I64d",&L[i],&R[i],&C[i]);int len=R[i]-L[i]+1;if(rt1[len]==0&&rt2[len]==0)rt1[len]=++tot,rt2[len]=++tot;insert(rt1[len],R[i],C[i],1,N);insert(rt2[len],L[i],C[i],1,N);  }LL ans=2e9+10;for(int i=1;i<=n;i++){int len=R[i]-L[i]+1;if(len>=x)continue;ans=min(ans,C[i]+min(que1(rt1[x-len],1,L[i]-1,1,N),que1(rt2[x-len],R[i]+1,N,1,N)));}if(ans==2e9+10)printf("-1\n");else printf("%I64d\n",ans);return 0;
}

  

D My pretty girl Noora

E Liar

F Madness

转载于:https://www.cnblogs.com/heisenberg-/p/7108739.html

codeforces round 422 div2 补题 CF 822 A-F相关推荐

  1. codeforces round 421 div2 补题 CF 820 A-E

    A Mister B and Book Reading  O(n)暴力即可 #include<bits/stdc++.h> using namespace std; typedef lon ...

  2. codeforces round 418 div2 补题 CF 814 A-E

    A An abandoned sentiment from past 水题 #include<bits/stdc++.h>using namespace std;int a[300],b[ ...

  3. codeforces round 420 div2 补题 CF 821 A-E

    A Okabe and Future Gadget Laboratory 暴力 #include<bits/stdc++.h> using namespace std; typedef l ...

  4. codeforces round 416 div2补题

    第一题,水题 A. Vladik and Courtes #include<bits/stdc++.h> using namespace std; int main() {long lon ...

  5. 【codeforces Round#801 Div2 D题 Tree Queries】树形贪心结论

    题目链接 题意: 给你一棵树,你需要执行多次询问来确定一个节点x的位置,对于每一次询问,你需要选择一个节点,能得到这个节点与x节点的距离是多少,问至少需要多少次询问才能确定x的位置. 分析: 有一个结 ...

  6. Educational Codeforces Round 114 (Rated for Div. 2) (A ~ F)全题解

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Educational Codeforces Round 114 (Rated for Div. 2) ...

  7. BC div2补题以及 复习模除 逆元__BestCoder Round #78 (div.2)

    第一题没话说 智商欠费 加老柴辅导终于过了 需要在意的是数据范围为2的63次方-1 三个数相加肯定爆了 四边形的定义 任意边小于其余三边之和 换句话说就是 最长边小于其余三边之和 这样的话问题转化为 ...

  8. Codeforces Round #652 div2 总结 端午节前小结

    2020.6.24 连着三天熬夜和一连串要处理的事情已然让我的身体有点吃不消.我只是喜欢想题的那种冥想思路开阔的感觉,但是熬夜还是不能行的.端午节前就暂时不碰竞赛了,昨天晚上算是打完了最后一场比赛.今 ...

  9. codeforces Round#429 (Div2)

    2017-08-20 10:00:37 writer:pprp 用头文件#include <bits/stdc++.h>很方便 A. Generous Kefa codeforces 84 ...

最新文章

  1. 1.3.8 excel for mysql_实时生成并下载大数据量的EXCEL文件,用PHP如何实现
  2. 阿里P9架构师分享:通俗易懂Redis原理,都是你没看过的
  3. 电子科技大学20春《c语言》在线作业1,[电子科技大学]20秋《C语言》在线作业123(答案)...
  4. C# 哈希表(Hashtable)用法笔记
  5. jquery 验证小数点后几位_(亲测可用)input只能输入数字或小数点后几位
  6. 布局—column(属性)
  7. java程序员必备基础知识
  8. axios发post请求,后端接收不到参数的问题
  9. 基于SSM的选课系统
  10. 台达伺服控制器接线图_伺服电机如何接线图
  11. Powertoys windows 10第三方桌面分块(分区)工具
  12. python敲七游戏代码_敲七游戏数字表
  13. nmos导通流向_技术参数详解,MOS管知识全录!
  14. VLAN-TAG 知识相关
  15. dalong(大龙燚火锅)
  16. vscode 创建Express框架 目录 坏境
  17. Ubuntu 下安装VirtualBox主要步骤及出现的问题的解决方案
  18. PythonScript_003_通过Cookie模拟登陆人人网
  19. Aspose.Words 将Word(DOC / DOCX)转换为HTML教程
  20. 调试winddows程序(windbg 和 Debug Diagnostic Tool)

热门文章

  1. 测绘技术的发展与分类简述
  2. malloc与new的区别
  3. windows已添加Pin码仍提示添加的解决方法
  4. 打开虚拟服务器设置,什么样配置的虚拟主机打开网站快
  5. JavaSE基础复习总结
  6. IDEA---Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found
  7. python错误代码40035_Python 创建XML
  8. 内部类的分类及其定义
  9. java中pi_Java-Pi的几种实现
  10. 时间排序python_算法导论 第八章 线性时间排序(python)