题意:有\(n\)个画家,\(m\)幅画,每个画家负责\(m\)幅画,只有前一个画家画完时,后面一个画家才能接着画,一个画家画完某幅画的任务后,可以开始画下一幅画的任务,问每幅画最后一个任务完成时的时间. 题解:这题可以用dp来写,当某个画家开始他的任务时,他的上一幅画的任务必须完成,并且他的前一个画家必须完成他的任务,我们用\(dp[i][j]\)表示第\(j\)个画家完成第\(i\)幅画任务时的时间,因为如果要合法的话,前面的两个条件都必须要满足,所以我们取两个状态的最大值,从而写出状态转移…
B. Art Union time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters…
B. Art Union time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters…
B. Art Union time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of n painters…
题目链接:http://codeforces.com/contest/283/problem/B 思路: dp[now][flag]表示现在在位置now,flag表示是接下来要做的步骤,然后根据题意记忆化搜索记忆,vis数组标记那些已经访问过的状态. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define REP(i, a, b) for (i…
A. Guess a number! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching th…
C. Running Track 题目连接: http://www.codeforces.com/contest/615/problem/C Description A boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for hi…
题目链接: http://codeforces.com/problemset/problem/214/E Relay Race time limit per test4 secondsmemory limit per test256 megabytes 问题描述 Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The gi…
B. Longtail Hedgehog 题目连接: http://www.codeforces.com/contest/615/problem/B Description This Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't m…
题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. 简单dp,dp[i]表示取i时zui最大和为多少,方程为dp[i] = max(dp[i - 1] , dp[i - 2] + cont[i]*i). #include <bits/stdc++.h> using namespace std; typedef __int64 LL; ; LL a…