Codeforces Round #292 (Div. 1)

A

简单题

B

用1*2的砖块铺满所有的点 方案数是否唯一

消去度数为1的 直到不能消为止 还有点就是无解或者不唯一

C

求任意两个端点u,v, 2 * h[u] + 2 * h[v] + d[u] + d[u+1] + ... +d[v]的最大值

转换

a[i] = 2*h[i]+(d[1]+d[2]+...+d[i])

b[i]= 2*h[i]-(d[1]+d[2]+...+d[i])

所求变成a[u]+b[v]的最大值并且 u > v 其实不用考虑u < v的情况 要考虑u != v的情况

时间: 2024-11-07 02:54:48

Codeforces Round #292 (Div. 1)的相关文章

Codeforces Round #292 (Div. 1) B. Drazil and Tiles(拓扑排序)

题目地址:codeforces 292 B 用队列维护度数为1的点,也就是可以唯一确定的点,然后每次找v1,v2,并用v2来更新与之相连的点,如果更新后的点度数为1,就加入队列.若最后还有为"."的,说明无解或解不唯一. 代码如下: #include <iostream> #include <string.h> #include <math.h> #include <queue> #include <algorithm> #i

Codeforces Round #292 (Div. 1) B. Drazil and Tiles (类似拓扑)

题目链接:http://codeforces.com/problemset/problem/516/B 一个n*m的方格,'*'不能填.给你很多个1*2的尖括号,问你是否能用唯一填法填满方格. 类似topsort,'.'与上下左右的'.',的相连.从度为1的点作为突破口. 1 //#pragma comment(linker, "/STACK:102400000, 102400000") 2 #include <algorithm> 3 #include <iostr

Codeforces Round #292 (Div. 2 Div. 1)

比赛链接:http://codeforces.com/contest/515  http://codeforces.com/contest/516 A. Drazil and Date time limit per test 1 second memory limit per test 256 megabytes Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. D

Codeforces Round #292 (Div. 2)

换了新ID,以前的ID 运气不好 D:题目隐藏的很深啊!如果说拓扑排序肯定会写,模型转换. 计算每个点'.'的度,度:周围4个点为'.'的数目. 然后BFS 枚举度为1的点 ,一遍构造,链接的点就度--: 再压入队列中 当枚举的点数不够'.'数目时,答案就是'unique'; 题目没要你输出any 这本身有蹊跷. #include <stdio.h> #include <string.h> #include <iostream> #include <algorit

Codeforces Round #292 (Div. 2) D. Drazil and Tiles [拓扑排序 dfs]

传送门 D. Drazil and Tiles time limit per test 2 seconds memory limit per test 256 megabytes Drazil created a following problem about putting 1 × 2 tiles into an n × m grid: "There is a grid with some cells that are empty and some cells that are occupie

Codeforces Round #292 (Div. 2) -- D. Drazil and Tiles (拓扑排序)

D. Drazil and Tiles time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil created a following problem about putting 1?×?2 tiles into an n?×?m grid: "There is a grid with some cells that a

Codeforces Round #292 (Div. 1)---A. Drazil and Factorial

Drazil is playing a math game with Varda. Let's define for positive integer x as a product of factorials of its digits. For example, . First, they choose a decimal number a consisting of n digits that contains at least one digit larger than 1. This n

Codeforces Round #292 (Div. 1) - B. Drazil and Tiles

B. Drazil and Tiles Drazil created a following problem about putting 1 × 2 tiles into an n × m grid: "There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tile

Codeforces Round #292 (Div. 2) -- B. Drazil and His Happy Friends

B. Drazil and His Happy Friends time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his f