Skip to content

Instantly share code, notes, and snippets.

@Shravan40
Last active December 24, 2015 17:49
Show Gist options
  • Save Shravan40/6838440 to your computer and use it in GitHub Desktop.
Save Shravan40/6838440 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int x1,y1,x2,y2,x3,y3;
int min_a = 999999999;
int max_a = 0;
int A;
int min_n = -1;
int max_n = -1;
for(int i=1; i<=n; i++)
{
cin>>x1 >>y1 >>x2 >>y2 >>x3 >>y3;
A = ((x1*(y2-y3)) + (x2*(y3-y1)) + (x3*(y1-y2))) / 2;
if(A < 0)
{
A *= -1;
}
if(A >= max_a)
{
max_a = A;
max_n = i;
}
if(A <= min_a)
{
min_a = A;
min_n = i;
}
}
cout<<min_n<<" "<<max_n<<"\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment