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


Whats Wrong with my code in HMAPPY2

Can somebody tell me what is wrong with my code for the problem HMAPPY2 in FEB19? I am really not able to figure out why its showing wrong answer. Please help! My code is as shown below :

asked 15 Feb, 18:09

chikkuttan's gravatar image

accept rate: 0%

edited 15 Feb, 18:25

All it has to do is with constraints if you look at constraints n <= 10^18 and time provided is 1 sec. So you cannot perform linear traversing. Try to solve it mathematically, if after a lot of tries you cannot solve take a look at my code(Python) -
c++ code:


answered 15 Feb, 20:36

ayush4's gravatar image

accept rate: 10%

edited 15 Feb, 21:03

toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 15 Feb, 18:09

question was seen: 95 times

last updated: 15 Feb, 21:03