Problem Description
bobo has a sequence a1,a2,…,an. He is allowed to swap two adjacent numbers for no more than k times.
Find the minimum number of inversions after his swaps.
Note: The numbe...
分类:
其他好文 时间:
2014-08-06 14:51:38
阅读次数:
177
Maximum sum
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 33363
Accepted: 10330
Description
Given a set of n integers: A={a1, a2,..., an}, we define a...
分类:
其他好文 时间:
2014-08-06 11:59:41
阅读次数:
186
Max Sequence
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 15569
Accepted: 6538
Description
Give you N integers a1, a2 ... aN (|ai|
You should ou...
分类:
其他好文 时间:
2014-08-06 11:59:11
阅读次数:
232
中国剩余定理用于求解 x≡ai(mod mi),其中mi两两互质,x有唯一解。
令M为mi的乘积,wi = M/mi,wi关于模mi的逆元为pi,即满足wi*pi + mi*qi = 1.
则上述方程组等价于 x≡ w1*p1*a1 + w2*p2*a2 +......+wk*pk*ak(mod M)..................................................
分类:
其他好文 时间:
2014-08-05 22:45:40
阅读次数:
191
Problem Description
bobo has a sequence a1,a2,…,an. He is allowed to swap two
adjacent numbers for no more than k times.
Find the minimum number of inversions after his swaps.
Note: The number...
分类:
其他好文 时间:
2014-08-05 22:44:03
阅读次数:
248
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo...
分类:
其他好文 时间:
2014-08-05 18:54:19
阅读次数:
282
Description
You have N integers, A1,
A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval.
The other ...
分类:
其他好文 时间:
2014-08-05 11:15:59
阅读次数:
243
# include
# include
# include
using namespace std;
int cmp(int x,int y)
{
return x>y;
}
int main()
{
int a[110],a1[110],a2[110],ans[110];
int n,k,k1,k2,i,k3;
while(~scanf("%d%d",&n,&k))
{
k1...
分类:
其他好文 时间:
2014-08-04 21:46:48
阅读次数:
237
UVA 12232 - Exclusive-OR
题目链接
题意:有n个数字,一开始值都不知道,每次给定一个操作,I a v表示确认a值为v,I a b v,表示确认a^b = v,Q k a1 a2 a3 ... ak,表示判断这些数字的异或值能否确定,能确定就输出值,如果有矛盾就停止
思路:带权并查集,权表示和父结点的异或值,那么多数判断的时候,只要所有数字和他的父结点的异或...
分类:
其他好文 时间:
2014-08-04 14:24:57
阅读次数:
208
题目连接:Sherlock and MiniMaxWatson gives Sherlock an arrayA1,A2...AN.He asks him to find an integerMbetweenPandQ(both inclusive), such that,min {|Ai-M|, ...
分类:
其他好文 时间:
2014-08-03 23:04:06
阅读次数:
380