Educational Codeforces Round 67
Educational Codeforces Round 67
CF1187B Letters Shop
二分
https://codeforces.com/contest/1187/submission/56313177
CF1187C Vasya And Array
直接构造
https://codeforces.com/contest/1187/submission/56316127
CF1187D Subarray Sorting
这题等System Test后更吧。。。
CF1187E Tree Painting
直接换根搜一遍
https://codeforces.com/contest/1187/submission/56366512
CF1187F Expected Square Beauty
有\(n\)个数,每个数\(x_i\)等概率取\([l_i,r_i]\)中一个值。
设\(B(x)\)是\(x\)相等连续段的数量
问\(E(B(x)^2)\)
神仙题Orz
\(E(B(x)^2)=E((1+\sum_{i=1}^{n-1}[x_i\neq x_{i+1}])^2)\)
\(=E(1+\sum_{1\leq i,j\leq n-1,i\neq j}[x_i\neq x_{i+1}][x_j\neq x_{j+1}]+3\sum_{i=1}^{n-1}[x_i\neq x_{i+1}])\)
用期望线性性做即可。
注意\(\sum_{1\leq i,j\leq n-1,i\neq j}[x_i\neq x_{i+1}][x_j\neq x_{j+1}]\),相邻的两个单独算,否则相互独立,直接乘
https://codeforces.com/contest/1187/submission/56395322
CF1187G Gang Up
有一个\(n\)个点\(m\)条边的无向连通图上有\(k\)人,这些人要到\(1\)点van♂you♂xi。每个时刻一个人可以走一条边,也可以不走。
一个人如果过了\(t\)时刻才到\(1\)号点,要付出\(c\cdot t\)的代价。
如果一条边在一个时刻一个方向上同时被\(a\)个人走,要付出\(d\cdot a^2\)的代价。
求最小代价。
显然分层图费用流。。。
可以发现最多只有\(n+k\)个时刻(我是sb以为有\(n\cdot k\)个就TTTTTTTTTTTTTTTTT)
平方费用直接拆边
分层直接建图跑费用流就行了。。。
https://codeforces.com/contest/1187/submission/56366481
Educational Codeforces Round 67的更多相关文章
- Educational Codeforces Round 67 D. Subarray Sorting
Educational Codeforces Round 67 D. Subarray Sorting 传送门 题意: 给出两个数组\(a,b\),现在可以对\(a\)数组进行任意次排序,问最后能否得 ...
- Educational Codeforces Round 67 (Rated for Div. 2)
A 考虑之前选中没有一个的,那么结果就是\(min(n-s,n-t)\) 那么能选中的第一次就是这个结果\(+1\),但需要拥有两个 \((s>t)\)考虑一开始选不中\(t\),则但选中\(t ...
- Educational Codeforces Round 67 (Rated for Div. 2) B题【前缀+二分】【补题ING系列】
题意:给出一个字符串s, 可以从左往右拿走s的字符, 至少要到s的第几个位置才能拼成t 思路:用二维数组记录前缀,然后二分即可. #include<bits/stdc++.h> using ...
- Codeforces Educational Codeforces Round 67
目录 Contest Info Solutions A. Stickers and Toys B. Letters Shop C. Vasya And Array D. Subarray Sortin ...
- Educational Codeforces Round 67 E.Tree Painting (树形dp)
题目链接 题意:给你一棵无根树,每次你可以选择一个点从白点变成黑点(除第一个点外别的点都要和黑点相邻),变成黑点后可以获得一个权值(白点组成连通块的大小) 问怎么使权值最大 思路:首先,一但根确定了, ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [Educational Codeforces Round 16]B. Optimal Point on a Line
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...
随机推荐
- zcmu 1540第k大数
1540: 第k大数Time Limit: 10 Sec Memory Limit: 128 MB[Submit][Status][Web Board]Description有两个序列a,b,它们的 ...
- Spring Boot 优雅的配置拦截器方式
https://my.oschina.net/bianxin/blog/2876640 https://cs.xieyonghui.com/java/55.html 其实spring boot拦截器的 ...
- HUAWEI,H3C 三层交换机 常用命令
<HUAWEI> display ip interface brief,命令全局模式下可以查看所有端口下的ip地址及物理状态display this interface,命令用来显示当前接 ...
- crunch制作字典
安装 安装crunch sudo apt-get install crunch 语法 crunch <min> max<max> <characterset> -t ...
- nodeJS实现简易爬虫
nodeJS实现简易爬虫 需求:使用nodeJS爬取昵图网某个分类下的图片并存入本地 运用nodeJS自带系统模块http.fs 示例代码: var http =require('http'); va ...
- Position定位相关知识了解
一.定位 position属性 1.默认定位: position:static; 元素框正常生成.块级元素生成一个矩形框,作为文档流的一部分,行内元素则会创建一个或多个行框,置于其 ...
- Web网站实现facebook登录
一.登录facebook开发者中心:https://developers.facebook.com 二.创建应用编号,如下图: 三.添加产品选择Facebook登录,如下图: 四.facebbok登录 ...
- ES读写索引内幕分析
一.简介 ES中的索引都进行分片,每个分片都会保存多个副本.这些副本称为复制组,在添加或删除索引时必须同步副本.如果不这样,从不同的副本中读取的索引可能截然不同.保持分片副本同步并从中提供读取的过程被 ...
- 一行Python代码画心型
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/yanlaifan/article/deta ...
- JavaScript获得URL地址栏参数防乱码
JavaScript获得URL地址栏参数防乱码 JavaScript中经常需要解析地址栏中拼接的参数.下面的代码基本是固定的代码,这里摘录下备用. //获得地址栏参数值 function getUrl ...