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


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;


asked 20 Jan '15, 18:58

arpanb8's gravatar image

accept rate: 13%

The indentation is all messed up...To see a nicely formatted code follow

(20 Jan '15, 19:00) arpanb83★
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: 20 Jan '15, 18:58

question was seen: 954 times

last updated: 20 Jan '15, 19:00

Related questions