×

# Multiples of 3 segment tree TLE

 0 I am trying to solve this qstn(https://www.codechef.com/problems/MULTQ3/) using lazy propagation of segment tree but i am getting TLE please help me to optimize About the code logic 1)Create a segment tree of node 2)each node keep the count of no of 0,1,2 obtained by doing mod in that range i.e a[i]%3 struct node { lli rem[3]; }; rem[0]==count number of all a[i] such that a[i]%3==0 rem[1]==count number of all a[i] such that a[i]%3==1 rem[2]==count number of all a[i] such that a[i]%3==2 for each node  3)Update the range as per given intrusions my code link http://ideone.com/U2XNLF asked 16 Nov '15, 02:13 2★nil96 180●7●18●45 accept rate: 5%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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,840
×1,665
×1,367
×834
×155

question asked: 16 Nov '15, 02:13

question was seen: 766 times

last updated: 16 Nov '15, 02:13