数据结构与算法习题 loser tree(败方树)

数据结构与算法习题 loser tree(败方树)
摘要由CSDN通过智能技术生成

数据结构与算法习题 loser tree(败方树)
Time Limit: 1000ms Memory Limit: 65536kB

Description
Given an interger array,you are required toconstruct a loser tree for it(compare twoadjacent array elements, and the comparison starts from the first element). Several modifications are made to the elements of the array. You arerequired to output the interger that every internal node represents for theloser trees that you constructed at first and got after every modification(theintergers are output according to the position of the internal node, from top tobottom,from left to right)

Input
The first line is the size of the array n and the number of modifications m.
The second line contains n intergers, they are elements of the array.
The next m lines represents the m modifications, every modification change the value of one element, each line contains two intergers, the first one is the index of the element modified,and the second is the value modified to.

Output
The output contains m+1 lines.
The first line is output of the interger that every internal node represents for the loser tree that you constructed at first(the intergers are output according to the position of the internal node, from top to bottom,from left to right)
The next m lines is ouput of the interger that every internal node represents for the loser tree constructed after the m modifications(the intergers are output according to the position of the internal node, from top to bottom,from left to right)

Sample Input

8 1

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值