kazama460's blog

By kazama460, history, 7 years ago, In English

I am trying to solve a problem on convex hull(my first problem on convex hull) , but don't know why getting WA. I am using Grahm's scan algo to generate all points of Hull , and then simply calculating the parameter of the hull. please can anyone tell me whats wrong with my code. thank you in advance.

Link to my code

Link to problem

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

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by kazama460 (previous revision, new revision, compare).

»
7 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I think the problem is when you are displaying the result. According to the question, the output should only include at most 1 place after decimal. For review you can see my submission — https://www.codechef.com/viewsolution/18489929

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I have tried to use setprecision function , but the problem is that it is giving SIGSEGV (dont know why) , here is the solution with setprecision , it is giving SIGSEGV. Can you help me out in this?

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      The runtime error might be due to accessing empty stack or popping from empty stack. I will debug the code shortly.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Thanx to you man , the problem was indeed the empty stack. after 24 unsuccessful submission , i got it accepted.