A. Maximum Square Ujan decided to make a new wooden roof for the house. He has…
Ujan decided to make a new wooden roof for the house. He has nn rectangular planks numbered from 11 to nn. The ii-th plank has size ai×1ai×1 (that is, the width is 11 and the height is aiai). Now, Ujan wants to make a square roof. He will first choos…
Codeforces Round #599 (Div. 2) D. 0-1 MST Description Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a descr…
久违的写篇博客吧 A. Maximum Square 题目链接:https://codeforces.com/contest/1243/problem/A 题意: 给定n个栅栏,对这n个栅栏进行任意排序,问可形成的最大正方形面积是多少 分析: 水题. 先排个序 , 然后暴力枚举正方形边长就可以了 #include<bits/stdc++.h> #define ios std::ios::sync_with_stdio(false) #define sd(n) scanf("%d&qu…
难题不会啊…… 我感觉写这个的原因就是因为……无聊要给大家翻译题面 A. Maximum Square 简单题意: 有$n$条长为$a_i$,宽为1的木板,现在你可以随便抽几个拼在一起,然后你要从这一大块木板中裁出一块最大的正方形. $1 \leq a_i \leq n \leq 1000$ 多测,$T \leq 10$ 给个官网的图: 直接排序然后扫就行了,这数据范围是不是让你想什么神奇东西了? #include <algorithm> #include <iostream> #…
B. Maximum Submatrix 2 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/375/B Description You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is…
B. Maximum Value Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/484/problem/B Description You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of ai divided by aj), whe…
 E. Maximum Matching 题目链接:https://codeforces.com/contest/1038/problem/E 题意: 给出n个项链,每条项链左边和右边都有一种颜色(范围1~4),然后每条项链都有对应的价值. 现在你可以任意改变项链的位置,也可以交换左右两边的颜色,问怎么做才能得到最大的价值.一条项链得到价值,就要求其左边的颜色和左边的项链右边颜色相等,并且右边的颜色和右边项链左边的颜色相等. 题解: 分析就可以发现这个题就是找一条权值最大的欧拉路径(每条边刚好经…
A. Black Square time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Squar…
http://codeforces.com/contest/281/problem/D 要求找出一个区间,使得区间内第一大的数和第二大的数异或值最大. 首先维护一个单调递减的栈,对于每个新元素a[i].要么直接插入后面,如果它插入栈内的某个元素的话.就是说有数字弹出来了,这个时候这个数字和a[i]组成的就是区间第一.第二大,9 8 5 4 3 2 1 7这样,最后那个7,弹出1,证明[7,8]这个区间第一.第二大的数字分别是1.和7,其他类似. 还有一个地方要注意的是: 要特别处理那些不能弹出的…