Naive Operations【2018 Multi-University Training Contest 2 G题】(线段树)

Problem Description In a galaxy far, far away, there are two integer sequence a and b of length n. b is a static permutation of 1 to n. Initially a...

2018-07-26 17:21:25

阅读数 59

评论数 0


题目描述: 现在有一棵二叉树,所有非叶子节点都有两个孩子。在每个叶子节点上有一个权值(有n个叶子节点,满足这些权值为1..n的一个排列)。可以任意交换每个非叶子节点的左右孩子。 要求进行一系列交换,使得最终所有叶子节点的权值按照遍历序写出来,逆序对个数最少。 input: 第一行n 下面...

2018-07-15 20:58:42

阅读数 99

评论数 0

Minimum Inversion Number HDU - 1394(权值线段树)

The inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. ...

2018-07-15 19:35:01

阅读数 53

评论数 0

Cleaning Shifts POJ - 3171 (线段树优化dp)

Farmer John’s cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer John, the ...

2018-04-15 22:05:42

阅读数 81

评论数 0

Digits Count FZU - 2105 (线段树)

Given N integers A={A[0],A[1],…,A[N-1]}. Here we have some operations: Operation 1: AND opn L R Here opn, L and R are integers. For L≤i≤R, we do A...

2018-04-13 20:07:20

阅读数 89

评论数 0

New Year Tree CodeForces - 620E(dfs序+线段树)

The New Year holidays are over, but Resha doesn’t want to throw away the New Year tree. He invited his best friends Kerim and Gural to help him to re...

2018-03-19 18:11:27

阅读数 61

评论数 0

Just a Hook HDU - 1698(线段树的懒惰标记)

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metalli...

2017-07-02 14:40:15

阅读数 301

评论数 0


ACM has bought a new crane (crane – jeřáb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th s...

2017-04-26 14:39:35

阅读数 240

评论数 0



2017-04-04 13:29:29

阅读数 143

评论数 0

敌兵布阵 HDU-1166(线段树)


2017-03-30 23:45:57

阅读数 355

评论数 0

取消 删除