Little Petya likes to draw. He drew N red and M blue points on the plane in such a way that no three points lie on the same line. Now he wonders what is the number of distinct triangles with vertices in red points which do not contain any blue point…
题意: 给出平面上n个点,问能在其中选出6个点,组成两个三角形,使得其互不相交 问有多少种选法 大致思路 考虑枚举一条直线,将所有得点分为左右两部分,其中有两个点在直线上, 以这两个点为顶点,分别统计左边有多少个三角形,右边有多少个三角形即可. 枚举直线时,枚举一个点,然后对其他点极角排序, 枚举另一个点,可快速算出该直线左右两边的点的数量(二分,叉积),组合一下即可. /* : . : i i . i : . i . i . i : . i . i i : . . . . . . . ..…
Fighting for Triangles 题目连接: http://codeforces.com/gym/100015/attachments Description Andy and Ralph are playing a two-player game on a triangular board that looks like the following: 1 2 3 4 5 7 8 6 9 10 11 13 14 16 17 12 15 18 At each turn, a playe…
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line…
C. Love Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/553/problem/C Description There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie.…
D. Vanya and Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/problem/D Description Vanya got bored and he painted n distinct points on the plane. After that he connected all the points pairwise and saw that as…