# Destroy Cells Lunchtine August 2019

**URL:** <https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628>\
**Category:** faq\
**Created:** [September 1, 2019, 11:48am UTC](https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628 "2019-09-01T11:48:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyanshu219](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@priyanshu219](https://discuss.codechef.com/u/priyanshu219)\
**Post date:** [September 1, 2019, 11:48am UTC](https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628/1 "2019-09-01T11:48:03Z")

</div>

Problem :[DESTCELL Problem - CodeChef](https://www.codechef.com/problems/DESTCELL)  
[CodeChef: Practical coding for everyone](https://www.codechef.com/viewsolution/26195612)  
In it for each K Firstly, I saw whether or not it is visited  
Then apply condition for i \<= n && j \<= m  
and change i and j accordingly  
According to me each loop will take O((m\*n)/(k+1))  
Can somebody find the reason for TLE  
Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![shivang\_1234](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@shivang\_1234](https://discuss.codechef.com/u/shivang_1234)\
**Post date:** [September 1, 2019, 11:57am UTC](https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628/2 "2019-09-01T11:57:10Z")

</div>

Convert all integer variable to long long int

---

<div class="post-metadata">

**Author:** ![ssrivastava990](https://discuss.codechef.com/user_avatar/discuss.codechef.com/ssrivastava990/32/216836_2.png) [@ssrivastava990](https://discuss.codechef.com/u/ssrivastava990)\
**Post date:** [September 1, 2019, 12:18pm UTC](https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628/3 "2019-09-01T12:18:13Z")

</div>

@anon55659401 will help u.

KARAN Dm me

---

<div class="post-metadata">

**Author:** ![priyanshu219](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@priyanshu219](https://discuss.codechef.com/u/priyanshu219)\
**Post date:** [September 1, 2019, 1:02pm UTC](https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628/4 "2019-09-01T13:02:22Z")

</div>

Firstly, there is no need for that as at max k = 10^6 which is in range  
Secondly, I tried it 😅

---

<div class="post-metadata">

**Author:** ![ajul\_raj](https://discuss.codechef.com/user_avatar/discuss.codechef.com/ajul_raj/32/6113_2.png) [@ajul\_raj](https://discuss.codechef.com/u/ajul_raj)\
**Post date:** [September 1, 2019, 3:05pm UTC](https://discuss.codechef.com/t/destroy-cells-lunchtine-august-2019/36628/5 "2019-09-01T15:05:04Z")

</div>

I think its because u are initialising the visited array each time .  
Just initialise it one time and mark it unvisited in the loop after counting.
