HDOJ Monthly 2009.01 Problem "light" - momodi's Blog
POJ Monthly Contest - 2010.1.24 - Problem A "Cake"

HDOJ Monthly 2009.01 Problem "light"

momodi posted @ Tue, 02 Feb 2010 10:52:57 +0800 in IProblem with tags Segment Tree HDOJ , 1662 readers

 http://acm.hdu.edu.cn/showproblem.php?pid=3275

这个题目比较简单。。。

我刚开始写的解题报告里面说:

 

 

Greedy and Segment Tree will be worked at this problem.
 
We need change all “0” to “1”, so let’s put our attention on the first lantern of the given string. There is only one way to change states of first lantern which is installing a switch to control the first k lanterns.
 
Algorithm:
  1. If the first lantern is off then install a switch to change the states of first k lanterns.
  2. Let the second lantern be the first one and repeat Step 1 until there are less than k lanterns.
  3. If all of the remaining lanterns are on then output the answer else output “-1”.
 
Native solution will get TLE as it’s running in O(n * k).
 
A new accelerated date structure should be used to storage all the states of lanterns. This date structure should support two operators.
  1. Find the states of one lantern.
  2. Change all states of an interval.
Segment Tree will be worked.
 

 

 

这里说的线段树其实就是区间覆盖那种,统计一个点的奇偶值就查看这个点被覆盖的总数就好了。

因为这里的区间的大小总是K,所以其实用不着线段树,线性扫描就好了。。。

 

Avatar_small
AAA said:
Sat, 21 May 2022 19:43:02 +0800

when i was still in high school, i always planned to take pyschology because it gives me great interest; buy sell signal software

 

=================================

 

we use wall arts at home because it is a very good and stylish decoration to add at your home“ water slide rentals sacramento

Avatar_small
AAA said:
Tue, 24 May 2022 16:42:57 +0800

After study many of the web sites with your internet site now, and i also genuinely such as your technique of blogging. I bookmarked it to my bookmark site list and you will be checking back soon. Pls have a look at my site at the same time and figure out if you agree. easyslot

 

========================

 

for kitchen knife, i would always use ceramic kitchen knifes because they are sharper and tougher than steel knifes., jili slot

 

==============================

 

My personal sis advised me personally about your internet site and exactly how excellent it truly is. She’s proper, I’m genuinely amazed using the composing and clever style. Seems like to me you’re merely itching the surface in terms of that which you might accomplish, nevertheless you’re off to a terrific start! pp slot

 

===================================

 

Excellent weblog, Just wanted to be able to remark will not really connect to the actual rss supply, you may choose put in the best wordpress tool to the to be able to workthat. easy slot

Avatar_small
AAA said:
Mon, 30 May 2022 06:13:07 +0800

An interesting discussion may be valued at comment. I do believe that you can write much more about this topic, it will not certainly be a taboo subject but usually people are insufficient to speak on such topics. An additional. Cheers honeygain es peligroso

 

==========================

 

I think other site owners should take this web site as an model – very clean and fantastic style and design, not to mention the content. You’re an expert in this area! our thriving home

Avatar_small
AAA said:
Mon, 30 May 2022 15:01:39 +0800

That is some inspirational stuff. Never knew that opinions could be this varied. Thanks for every one of the enthusiasm to supply such tips here. Click here

Avatar_small
AAA said:
Mon, 30 May 2022 23:16:30 +0800

fashion jewelries will be one of the best stuffs that you can use to enhance your personal style’ ikea vrio analysis

Avatar_small
AAA said:
Wed, 01 Jun 2022 15:30:45 +0800

When visiting blogs, i usually discover a very good content like yours สล็อต เครดิตฟรี แค่สมัคร

 

==========================

 

I like this website it's a master piece! Glad I found this on google. สล็อต ฝาก 10 รับ 100

 

============================

 

Thanks for the writeup. I definitely agree with what you are saying. I have been talking about this subject a lot lately with my brother so hopefully this will get him to see my point of view. สล็อต ฝาก 50 รับ 100 ถอนไม่อั้น

 

============================

 

Good day! This post could not be written any better! Reading this post reminds me of my previous room mate! He always kept chatting about this. I will forward this write-up to him. Fairly certain he will have a good read. Thanks for sharing! สล็อต ยืนยัน otp รับเครดิตฟรี 100

 

=============================

 

of course data entry services are very expensive that is why always make a backup of your files“ สล็อต ยืนยัน otp รับเครดิตฟรี 50

 

===================================

 

This internet site is my breathing in, very great pattern and perfect content . สล็อต11

 

================================

 

This is a good subject to talk about. Sometimes I fav stuff like this on Redit. This article probably wont do well with that crowd. I will be sure to submit something else though. สล็อตฝาก 20 รับ 100 วอเลท

 

================================

 

I certainly enjoyed the method that you explore your experience and perception of the area of interest สล็อตฝากถอนไม่มีขั้นต่ำ ผ่านวอเลท

Avatar_small
meidir said:
Sat, 20 Aug 2022 00:08:38 +0800

If you are able to get her to go along with this, post the location: I’m sure there are lots of Y!A users who’d like to read her stuff. 뉴헤븐카지노먹튀

Avatar_small
meidir said:
Tue, 23 Aug 2022 19:25:48 +0800

It is my very first time that i have a look at this website. I recently came across countless interesting information in your weblog notably this discussion. Among the numerous responses on your writings, I guess I’m not the only one experiencing all of the excitement right here! 온라인바카라

Avatar_small
meidir said:
Fri, 26 Aug 2022 21:01:43 +0800

Hey there, Can I copy this post image and implement it on my personal web log? 온라인카지노


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter