传送门 Description You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next mon…
传送门 Description You are given a table consisting of n rows and m columns. Numbers in each row form a permutation of integers from 1 to m. You are allowed to pick two elements in one row and swap them, but no more than once for each row. Also, no more…
1. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort    暴力枚举,水 1.题意:n*m的数组,每行最多可交换1次,列最多可交换两列,问最终是否可以变换到每行都是1~m. 2.总结:暴力即可. #include<bits/stdc++.h> #define F(i,a,b) for (int i=a;i<b;i++) #define FF(i,a,b) for (int i=a;i&l…
B. Batch Sort 题目连接: http://codeforces.com/contest/724/problem/B Description output standard output You are given a table consisting of n rows and m columns. Numbers in each row form a permutation of integers from 1 to m. You are allowed to pick two e…
http://codeforces.com/contest/724/problem/C 题目大意: 在一个n*m的盒子里,从(0,0)射出一条每秒位移为(1,1)的射线,遵从反射定律,给出k个点,求射线分别第一次经过这些点的时间. 解法一: (模拟) 射线不管怎么反射,都是和水平方向成45°角的,也就是说每一段射线上的点,横坐标和纵坐标的和或者差相等. 把每一个点放入它所对应的对角线里,然后模拟射线的路径就好. 代码: #include <iostream> #include <cstd…
题目链接:http://codeforces.com/contest/724/problem/E 题目大意: 有n个城市,每个城市有pi件商品,最多能出售si件商品,对于任意一队城市i,j,其中i<j,可以从城市i往j运输最多c件商品. 求最多一共能卖出多少件商品.  n<=10000 解法一(官方解法): 构造网络流,因为边太多,不可能直接跑最大流. 根据图的特殊性,考虑用dp求解最小割. 状态:dp[i,j]表示前i个中有j个和源点相通的最小割. 转移:如果第i个点不和源点相连,那么pi这…
http://codeforces.com/contest/724/problem/D 题目大意:给你一个串,从串中挑选字符,挑选是有条件的,按照这个条件所挑选出来的字符集合sort一定是最后选择当中最小的. 从pos=0开始挑选,每次挑选pos~pos+m-1这些位置中的字符,然后下一次再从之前挑选字符的位置开始的后面的m个中进行挑选. 思路:先贪心,按照字典序,每次找到该范围区间内最小的字符,因为该字符一定是串中的一部分,所以必然会被挑选的,于是我们先把这个pos的字符放入集合,并且对挑选过…
E. Goods transportation 题目连接: http://codeforces.com/contest/724/problem/E Description There are n cities located along the one-way road. Cities are numbered from 1 to n in the direction of the road. The i-th city had produced pi units of goods. No mo…
D. Dense Subsequence 题目连接: http://codeforces.com/contest/724/problem/D Description You are given a string s, consisting of lowercase English letters, and the integer m. One should choose some symbols from the given string so that any contiguous subse…
C. Ray Tracing 题目连接: http://codeforces.com/contest/724/problem/C Description oThere are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly…