Codeforces Round #178 (Div. 2)
A. Shaass and Oskols
- 模拟。
B. Shaass and Bookshelf
- 二分厚度。
- 对于厚度相同的书本,宽度竖着放显然更优。
- 宽度只有两种,所以枚举其中一种的个数,另一种的个数是单调的。
C. Shaass and Lights
- 考虑一段连续未点亮的灯,显然每次操作都只会将区间长度减一,继而推得长度L的方案数为\(2^{L - 1}\)种。
- 考虑有若干段Li合并,对于一个区间来说,内部的操作顺序应该是相对不变的,那么就是挖空填即可。
- 注意判断两端的状态,即考虑1、n的状态。
D. Shaass and Painter Robot
- 注意起点必然是在边界上。
- 对于第1行和第n行,如果需要染色的格子被访问过,那么对应的两条对角线的所有点必然也被访问过了。所以为了判断是否所有需要染色的格子均染色,只需要判断上下两行的格子状态(不会严格证明)。
- \(dp(i,j,k)\)表示访问格子(i, j),方向为k时的最早时间,答案就是需染色的格子的时间最大值。
- 由于最后终点可能在第1列或第m列,所以还需要记录这两列的时间信息。
E. Shaass the Great
- 题意相当于切掉一条边后,将这条边重新连接两个点,使得所有点对的距离和最小。
- 切掉一条边后,属于同一子树的点对距离和不变。那么只要考虑两部分的距离和即可。
Codeforces Round #178 (Div. 2)的更多相关文章
- Codeforces Round #178 (Div. 2) B. Shaass and Bookshelf —— DP
题目链接:http://codeforces.com/contest/294/problem/B B. Shaass and Bookshelf time limit per test 1 secon ...
- Codeforces Round #178 (Div. 2) B .Shaass and Bookshelf
Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensi ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #262 (Div. 2) 1004
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...
随机推荐
- Leetcode697.Degree of an Array数组的度
给定一个非空且只包含非负数的整数数组 nums, 数组的度的定义是指数组里任一元素出现频数的最大值. 你的任务是找到与 nums 拥有相同大小的度的最短连续子数组,返回其长度. 示例 1: 输入: [ ...
- php_imagick是怎么实现复古效果的呢?
php_imagick程序示例 1.创建一个缩略图并显示出来 <?phpheader('Content-type: image/jpeg');$image = new Imagick('imag ...
- Failed to delete access_log
重复build 关闭已经开启的tomcat terminal 再次开启即可
- python 类的创建
- pl/sql基础知识—定义并使用变量
n 介绍 在编写pl/sql程序是,可以定义变量和常量:在pl/sql程序中包括有: ①标量类型(scalar) ②复合类型(composite) ③参照类型(reference) ④lob(lar ...
- 2018-2-13-win10-uwp-获取按钮鼠标左键按下
title author date CreateTime categories win10 uwp 获取按钮鼠标左键按下 lindexi 2018-2-13 17:23:3 +0800 2018-2- ...
- 创建linux中的nginx+php7+mysql环境----PHP7安装
默认CentOs 的源 并没有php7的安装路径,所以需要手动添加源: # rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-l ...
- 【转载】Combination Sum
Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique combin ...
- Python中的TCP三次握手和四次挥手过程
tcp三次握手和四次挥手 首先先介绍什么是传输层: 1.三次握手 1) 三次握手的详述 首先Client(客户)端发送连接请求报文,Server(服务器)段接受连接后回复ACK报文,并为这次连接分配资 ...
- HDU 5572 An Easy Physics Problem【计算几何】
计算几何的题做的真是少之又少. 之前wa以为是精度问题,后来发现是情况没有考虑全... 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5572 题意: ...