devarshi09's blog

By devarshi09, history, 6 years ago, In English

I am getting WA in Spoj Problem ,Build the fence . Link to the problem : https://www.spoj.com/problems/BSHEEP/ Link to my code : https://ideone.com/NpcblK . Can anyone help me to find the error or give any counter test case. I used graham scan algorithm to make my code efficient.

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

»
6 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Lmao are you fucking kidding me. You say like two words about your solution. Do you even expect someone to answer?

Your code is filled with crappy shorthands which are impossible to parse for anyone else. What is more, your code is not even indented properly.

How do you even think someone is going to parse what you might mean by

bool cmp(pair<int,pair<int,int> > a,pair<int,pair<int,int> > b){
    if(a.se.se==b.se.se && a.se.fi!=b.se.fi) return a.se.fi<b.se.fi;
    if(a.se.fi==b.se.fi) return a.fi<b.fi;
    return a.se.se<b.se.se;
}

or maybe

a.fi=pts[0].fi;
a.se.se=pts[0].se.se;
a.se.fi=pts[0].se.fi;
 
b.fi=pts[n-1].fi;
b.se.se=pts[n-1].se.se;
b.se.fi=pts[n-1].se.fi;