Codeforces Round #194 (Div. 2) B. Eight Point Sets 模拟

Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, except for the average of these nine points. In other words, there must be three integers x1, x2, x3 and three more integers y1, y2, y3, such that x1 < x2 < x3, y1 < y2 < y3 and the eight point set consists of all points (xi, yj) (1 ≤ i, j ≤ 3), except for point (x2, y2).

You have a set of eight points. Find out if Gerald can use this set?

Input
The input consists of eight lines, the i-th line contains two space-separated integers xi and yi (0 ≤ xi, yi ≤ 106). You do not have any other conditions for these points.

Output
In a single line print word “respectable”, if the given set of points corresponds to Gerald’s decency rules, and “ugly” otherwise.

Examples
inputCopy
0 0
0 1
0 2
1 0
1 2
2 0
2 1
2 2
outputCopy
respectable
inputCopy
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
outputCopy
ugly
inputCopy
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
outputCopy
ugly

排序+模拟即可(水题一道)

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
//#pragma GCC optimize("O3")
using namespace std;
#define maxn 20005
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
typedef long long  ll;
typedef unsigned long long ull;
typedef unsigned int U;
#define ms(x) memset((x),0,sizeof(x))
const long long int mod = 1e9 + 7;
#define sq(x) (x)*(x)
#define eps 1e-6
const int N = 2500005;

inline int read()
{
	int x = 0, k = 1; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-')k = -1; c = getchar(); }
	while (c >= '0' && c <= '9')x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
	return x * k;
}

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}

mapmp;

struct node {
	int a, b;
	bool operator <(const node&rhs)const {
		if (a == rhs.a)return b < rhs.b;
		return a < rhs.a;
	}

}nod[10];

int main()
{
	ios::sync_with_stdio(false);
	int i, j;
	int flag = 0;
	for (i = 0; i < 8; i++) {
		cin >> nod[i].a >> nod[i].b;
		mp[nod[i].a]++;
	}
	sort(nod, nod + 8);
	if (nod[0].a == nod[1].a&&nod[1].a == nod[2].a&&nod[0].b

你可能感兴趣的:(CF)