coco_elon's blog

By coco_elon, history, 7 years ago, In English

This is my solution for 86D : Powerful Array. Link: http://ideone.com/618TcS

This gave me a TLE at test 6, taking more than 5000 ms whereas most AC solutions pass at 800 — 1000 ms. How do I optimize my code? Thanks in advance!

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

By coco_elon, history, 8 years ago, In English

I found this question in Codeforces Round #373 (Div. 2).

http://mirror.codeforces.com/problemset/problem/719/B

My solution:

https://ideone.com/RYOQkS

Can someone please help me find why my solution fails and how to correct it accordingly?

Thanks in advance!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By coco_elon, history, 8 years ago, In English

Here is my solution to SPOJ Problem CHAIN : https://ideone.com/Egu19B

My solution involves maintaining 3 arrays, for containing the root node of each disjoint set as well as the root nodes of predator and prey of that disjoint set. The solution gives a WA, I've verified it for a lot of test cases and am unable to understand why it fails. Can anybody tell me where my solution fails, perhaps even provide me with a test case where it does not work?

The problem : http://www.spoj.com/problems/CHAIN/

Thanks!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By coco_elon, history, 8 years ago, In English

My code : https://ideone.com/QJtb9E . My bottom up solution gives WA. If possible, can someone provide me with test cases where it fails? Thanks!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By coco_elon, history, 8 years ago, In English

NHAY is a SPOJ question involving pattern search. The Link: http://www.spoj.com/problems/NHAY/

My solution gives me TLE. Here is my code: https://ideone.com/A2N6An What are some optimizations that I can apply on my code?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it