Wrong Answer...RECTANGLE (Afternoon Session of ZCO 2015)

Hey Everybody,
Here’s my code:

#include "iostream"

#include “algorithm”
#include “cmath”

using namespace std;

struct point {
int x, y;

bool comp(point a, point b)

return (a.x<b.x);


int main()

int n;
cin >> n;
point wtf[n];
for (int i = 0; i<=n-1; i++)
cin >> wtf[i].x >> wtf[i].y;

sort (wtf, wtf+n, comp);
int length=0, breadth=0;	
length=max(length, wtf[0].x);
length=max(length, 100000-wtf[n-1].x);
int p;
for (p=0; p<=n-2; p++)
length = max(length, wtf[p+1].x-wtf[p].x);

for (int q = 0; q<=n-1; q++)

sort (wtf, wtf+n, comp);
breadth=max(breadth, wtf[0].x);
breadth=max(breadth, 500-wtf[n-1].x);
for (p=0; p<=n-2; p++)
breadth = max(breadth, wtf[p+1].x-wtf[p].x);
cout << (length)*(breadth);
return 0;


The indentation is all messed up…To see a nicely formatted code follow http://cpp.sh/57sm