You are not logged in. Please login at www.codechef.com to post your questions!

×

FNCS - getting WA

I tried solving the problem FNCS using the concept of segment trees.
I got the implementation from geeksforgeeks.com
I got TLE for all subtasks except 1 ,for which i got WA
I tried a different test case from that given in the question and it works fine
HERE is my submission
Can anyone get me some test cases that may fail,or give me some clue on where i am going wrong?

asked 17 Nov '14, 17:25

raghav710's gravatar image

2★raghav710
142
accept rate: 0%

retagged 17 Nov '14, 19:02

pushkarmishra's gravatar image

4★pushkarmishra
1.3k156581


Can you describe more your approach?

I also used segment tree for subtask 1, because there are at most 1000 queries, so with 1000 functions we can update each function in each query, but what is your idea to solve it quecker than in O(N * Q) ?

Also I see, you are using cin and cout which would lead to TLE I'm afraid.

edit:
I misunderstood. Try this input:

4
1000000000 1000000000 1000000000 1000000000
1 1
2 2
3 3
4 4
4
2 1 1
2 1 2
2 1 3
2 1 4
link

answered 17 Nov '14, 17:40

betlista's gravatar image

3★betlista ♦♦
16.9k49115225
accept rate: 11%

edited 17 Nov '14, 17:45

Thanks a lot for looking at my code and giving me pointers on what to do :)Shall look into it :)

(18 Nov '14, 22:12) raghav7102★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,755
×14

question asked: 17 Nov '14, 17:25

question was seen: 863 times

last updated: 18 Nov '14, 22:12