CodeForces - 426A(排序)】的更多相关文章

Sereja and Mugs Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Sereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n wate…
题目链接:http://codeforces.com/problemset/problem/459/B 题意: 给出n支花,每支花都有一个漂亮值.挑选最大和最小漂亮值得两支花,问他们的差值为多少,并且有多少种选法(无先后顺序). 现场做时,想到的是:用multimap记录每个漂亮值出现的次数,并不断更新最大最小值. 这个方法很笨,而且multimap的val值是多余的. 需要注意特殊情况:max==min 代码如下: #include<iostream>//A - Pashmak and Fl…
20170710: hdu1074,hdu1087,hdu1114,hdu1159,hdu1160,hdu1171,hdu1176,hdu1010,hdu1203 20170711: hdu1231,hdu1257,hdu1260,hdu1284,hdu1421,hdu1789,hdu1978,hdu2059,hdu2084 20170712: hdu2159,hdu2191,hdu2544,hdu2571,hdu2602,hdu2709,hdu1015,hdu1016 20170713: co…
B. Drazil and Tiles 题目连接: http://codeforces.com/contest/516/problem/B Description Drazil created a following problem about putting 1 × 2 tiles into an n × m grid: "There is a grid with some cells that are empty and some cells that are occupied. You s…
E. A Simple Task Problem's Link: http://codeforces.com/problemset/problem/558/E Mean: 给定一个字符串,有q次操作,每次操作将(l,r)内的字符升序或降序排列,输出q次操作后的字符串. analyse: 基本思想是计数排序. 所谓计数排序,是对一个元素分布较集中的数字集群进行排序的算法,时间复杂度为O(n),但使用条件很苛刻.首先对n个数扫一遍,映射出每个数字出现的次数,然后再O(n)扫一遍处理出:对于数字ai,…
题目链接:http://codeforces.com/contest/558/problem/E 题意:有一串字符串,有两个操作:1操作是将l到r的字符串升序排序,0操作是降序排序. 题解:建立26棵线段树,类似计数排序思想. #include <bits/stdc++.h> using namespace std; ; struct SegTree { ], sum[], l, r; }T[N << ]; ][N]; void pushup(int p, int c) { T[p…
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…
C. Mail Stamps Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/29/C Description One day Bob got a letter in an envelope. Bob knows that when Berland's post officers send a letter directly from city «A» to city «B…
C. Day at the Beach One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles. At the end of the…
Partial Tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/C Description You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the mini…