Please help in this past ICPC problem

problem link : https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=6083

my solution : vrUUHp - Online C++0x Compiler & Debugging Tool - Ideone.com

it is simple brute force but i didn’t able to figure out why my solution gives runtime error (:

please help !

@pk301 your code’s complexity is O(2^n) and n is upto 100 that’s why you’re getting runtime error, since you cannot allocate this much memory.

thanks for your answer but n is only 10 the test case is upto 100 !
n (2 ≤ n ≤ 10)

1 Like

Can you remove the link from title and add it to question?

@vijju123 done ! :slight_smile:

@pk301 sorry, got confused between n and test cases

can someone please help me with my code or may give an accepted code!
it will be helpful :slight_smile: