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…
传送门:D Dense Subsequence 题意:输入一个m,然后输入一个字符串,从字符串中取出一些字符组成一个串,要求满足:在任意长度为m的区间内都至少有一个字符被取到,找出所有可能性中字典序最小的情况,并按字典序输出 思路:字典序 例如 aaaaaaab < ab  也就是说,如果满足要求的取法中取到了b 那么所有的a都应该被取到,这样才可以保证字典序最小,那么也就是说在26个字母中找到一定要被取的最大字母,然后再确定最大的字母的个数,比它小的全部要取 AC代码: #include &quo…
链接 题意:输入n,m,表示一个n行m列的矩阵,每一行数字都是1-m,顺序可能是乱的,每一行可以交换任意2个数的位置,并且可以交换任意2列的所有数 问是否可以使每一行严格递增 思路:暴力枚举所有可能的列变换 然后在所有可能的情况下求是否存在一种情况可以使每一行最多进行一次交换最后得到严格递增的矩阵 AC代码: #include "iostream" #include "stdio.h" #include "string.h" using name…
我不告诉你这个链接是什么 分析:模拟可以过,但是好烦啊..不会写.还有一个扩展欧几里得的方法,见下: 假设光线没有反射,而是对应的感应器镜面对称了一下的话 左下角红色的地方是原始的的方格,剩下的三个格子是镜面对称的结果.原来的点是的话,剩下三个点从左上到右下分别是,,.真实情况是一个点不止只有这三个镜像点,一个点可以在平面内生成无数个点,可以用坐标表示为为任意非负整数. 假设光线没有经过反射,那么用函数可以表示为,这样要求包括镜像点在内的所有点,于是就有二元一次方程,可以改成四个二元一次方程式,…
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这…
传送门 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…
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 tha…
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 month w…