题目链接:http://codeforces.com/problemset/problem/459/C 题意:有n个人,k辆车,d天要求没有两个人在d天都坐在一起.输出坐的方法. 题解:这题很有意思,首先在这d天里每个人都有一个序列那就是每天坐哪辆车.然后为了满足题意只要他们 的序列都是独一无二的就行.也就是说k辆车,d天总共有k^d次方的坐法,所以最多能提供k^d个人.然后 就是怎么输出了,这有一个技巧,只要构成d位的k进制数就行.然后遍历1-n依次加1即可. #include <iostre…
题目链接:http://codeforces.com/contest/459/problem/D 题意:给出数组a,定义f(l,r,x)为a[]的下标l到r之间,等于x的元素数.i和j符合f(1,i,a[i])>f(j,n,a[j]),而且要求i<j,求i和j的种类数. 题解:先预处理一下设map be[a[i]]表示f(1,i,a[i])的值,然后在倒着来设af[a[j]]表示f(j,n,a[j])的值. 然后再用线段树更新一下长度为af[a[j]]的值然后再在树上查询小于be[a[j-1]…
题目链接:http://codeforces.com/problemset/problem/459/A 题目意思:给出两个点的坐标你,问能否判断是一个正方形,能则输出剩下两点的坐标,不能就输出 -1. 这题更傻了,在考虑对角线的两点时,少考虑了一种情况:两个点分属不同象限:这时需要用到绝对值函数 abs ! 最近集训不知道是不是搞傻左,反正CF的题目打了几场,结果都很惨,有一点点恐惧感,怕跌回以前不堪的rating.唉---继续努力吧!!! #include <iostream> #inclu…
题目链接:http://codeforces.com/problemset/problem/459/B 题目意思:有 n 朵 flowers,每朵flower有相应的 beauty,求出最大的beauty 差 和 要达到这个最大的差 的取法有多少种. 一下子wa,是因为没考虑到整个序列都是相同的beauty 时的情况,以为取法是一种= =.注意,beauty 差为0都是合法的.还有注意这句话:Two ways are considered different if and only if the…
题目链接:http://codeforces.com/contest/459/problem/E 题意:给出m条边n个点每条边都有权值问如果两边能够相连的条件是边权值是严格递增的话,最长能接几条边. 题解:先按照边权排序一下,然后再利用dp求最值. 显然可以设dp[i]表示以i点为结尾最长能连几条边,dp[v]=dp[u]+1,u表示指向v的那个点,还有一点要注意的. 可能会遇到边权值相同的情况,这时候就不能这么转移了,所以在处理dp是要先处理一下边权相同的几个点. for(int i = 0…
题目地址:http://codeforces.com/contest/459/problem/C C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The com…
先上题目+: C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a…
C - Pashmak and Buses Codeforces Round #261 (Div. 2) C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The…
E - Pashmak and Buses Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 459C Description Recently Pashmak has been employed in a transportation company. The company has k buses and has a c…
C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school…