题目连接 题意: 给n*m的0/1矩阵,q次操作,每次有两种:1)将x,y位置值翻转 2)计算以(x,y)为边界的矩形的面积最大值 (1 ≤ n, m, q ≤ 1000) 分析: 考虑以(x,y)为下边界的情况,h=(x,y)上边最多的连续1的个数.那么递减的枚举,对于当前hx,仅仅须要看两側能到达的最远距离,使得h(x,ty)不大于h就可以.之后的枚举得到的两側距离大于等于之前的,所以继续之前的两側距离继续枚举就可以. const int maxn = 1100; int n, m, q;…
题目连接 题意: 给n和m,一行m个1<=x<=n的数.记c=.如今仅仅能选择一个数x变成y,序列中全部等于x的值都变成y,求最小的c 分析: 对于一个数x,把与他相邻的所有的非x的数所有写下来. 假设x增大,那么一部分值增大.一部分减小,且每一个数的增大值或减小值都是x的变化值(均相等),也就是说总的结果仅仅和比x大的数与比x小的数的数量有关,所以即中位数. const int maxn = 110000; LL ipt[maxn]; map<LL, vector<LL>…
题目传送门 /* 构造水题:对于0的多个位数的NO,对于位数太大的在后面补0,在9×k的范围内的平均的原则 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; int a[MAXN]; int main(void) //Codeforces Round #…
B. Nanami's Digital Board 题目连接: http://www.codeforces.com/contest/434/problem/B Description Nanami is an expert at playing games. This day, Nanami's good friend Hajime invited her to watch a game of baseball. Unwilling as she was, she followed him to…
比赛链接:http://codeforces.com/contest/433 A. Kitahara Haruki's Gift time limit per test:1 second memory limit per test:256 megabytes Kitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between th…
D - Nanami's Power Plant 思路:类似与bzoj切糕那道题的模型.. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #defin…
题目链接:http://codeforces.com/contest/433/problem/C 思路:可以想到,要把某一个数字变成他的相邻中的数字的其中一个,这样总和才会减少,于是我们可以把每个数的左右两个相邻的数字存起来,然后我们可以想到,把某个数变成这些相邻的数的中位数总和最小. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include…
题目:http://codeforces.com/contest/433/problem/C 没想到做法就各种纠结, 今天做的都快疯掉了, 太弱了, 等题解一出,就各种恍然大悟 不应该不应该 正文: N这个条件是有用的,然后我们可以将数据一个点连接他所有想接的点,但是相等的点就不要连接, EG: 1 2 3 4 5 4 3 1 3 2,1 5,1 6; 对于1:2,3,3,2,5,5,6;三个点:每个点都这样连一下, 然后对于一个点,比如还是1:我们改变1使其到所有相邻的点距离最小,所有sort…
A. Ryouko's Memory Note 题目连接: http://www.codeforces.com/contest/434/problem/A Description Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ry…
http://codeforces.com/contest/559/problem/A 题目大意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形. 解: 性质1:边长为n的正三角形能够划分成n*n个边长为1的正三角形. 绘图找规律 性质2:延长各边总能找到一个大的正三角形.而且所求等于大三角形减去三个补出来的三个三角形面积 收获: 以后先找规律,看能不能找出一些特征即使不会证明 其次,总的减去部分化为所求假设想求的难以直接求 #include <…