#include<cstdio>#include<algorithm>using namespace std;const int maxn = 2 * 1E5 + 10;struct Point {int x,y,id;Point(int a = 0 , int b = 0):x(a),y(b){};bool operator < (const Point & a)const{return x < a.x || (x == a.x && y < a.y);}Point operator - (const Point & a)const{return Point(x - a.x,y-a.y);}int operator ^ (const Point & a)const{return x*a.y - y*a.x;}}p[maxn];int main(){int n;scanf("%d",&n);for(int i = 0 ; i < n ; ++i){scanf("%d%d",&p[i].x, &p[i].y);p[i].id = i + 1;}int flg = 1;sort(p,p+n);Point tmp = p[1] - p[0];for(int i = 2 ; i < n ; ++i){if((p[i] - p[0])^tmp){flg = 0;break;}}if(flg) printf("1\n%d %d\n",p[0].id, p[n - 1].id);else printf("0\n");return 0;}
[2016-04-16][URAL][2067][Friends and Berries]
原文:http://www.cnblogs.com/qhy285571052/p/a58630172a5c62c2ce02dfa8c93d784a.html