답안 #226255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
226255 2020-04-23T08:44:11 Z dolphingarlic Dragon 2 (JOI17_dragon2) C++14
100 / 100
2582 ms 2296 KB
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

struct Point {
	ll x, y;
} A, B;

inline bool ccw(Point X, Point Y, Point Z) {
	return (X.x - Y.x) * (Z.y - Y.y) <= (X.y - Y.y) * (Z.x - Y.x);
}

vector<Point> by_tribe[30000];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	FOR(i, 0, n) {
		Point p;
		int tribe;
		cin >> p.x >> p.y >> tribe;
		by_tribe[tribe - 1].push_back(p);
	}
	cin >> A.x >> A.y >> B.x >> B.y;

	int q;
	cin >> q;
	while (q--) {
		int x, y;
		cin >> x >> y;
		int ans = 0;
		for (Point i : by_tribe[x - 1]) for (Point j : by_tribe[y - 1]) {
			if (ccw(i, A, B)) ans += (ccw(i, A, j) && ccw(j, B, i));
			else ans += (ccw(j, A, i) && ccw(i, B, j));
		}
		cout << ans << '\n';
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1152 KB Output is correct
2 Correct 24 ms 1152 KB Output is correct
3 Correct 30 ms 1152 KB Output is correct
4 Correct 40 ms 1280 KB Output is correct
5 Correct 33 ms 1280 KB Output is correct
6 Correct 7 ms 1152 KB Output is correct
7 Correct 7 ms 1152 KB Output is correct
8 Correct 11 ms 1152 KB Output is correct
9 Correct 10 ms 1152 KB Output is correct
10 Correct 11 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1004 ms 1712 KB Output is correct
2 Correct 1768 ms 1736 KB Output is correct
3 Correct 53 ms 1920 KB Output is correct
4 Correct 19 ms 1792 KB Output is correct
5 Correct 20 ms 1920 KB Output is correct
6 Correct 997 ms 1912 KB Output is correct
7 Correct 955 ms 1788 KB Output is correct
8 Correct 500 ms 1780 KB Output is correct
9 Correct 469 ms 1664 KB Output is correct
10 Correct 509 ms 1788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1152 KB Output is correct
2 Correct 24 ms 1152 KB Output is correct
3 Correct 30 ms 1152 KB Output is correct
4 Correct 40 ms 1280 KB Output is correct
5 Correct 33 ms 1280 KB Output is correct
6 Correct 7 ms 1152 KB Output is correct
7 Correct 7 ms 1152 KB Output is correct
8 Correct 11 ms 1152 KB Output is correct
9 Correct 10 ms 1152 KB Output is correct
10 Correct 11 ms 1152 KB Output is correct
11 Correct 1004 ms 1712 KB Output is correct
12 Correct 1768 ms 1736 KB Output is correct
13 Correct 53 ms 1920 KB Output is correct
14 Correct 19 ms 1792 KB Output is correct
15 Correct 20 ms 1920 KB Output is correct
16 Correct 997 ms 1912 KB Output is correct
17 Correct 955 ms 1788 KB Output is correct
18 Correct 500 ms 1780 KB Output is correct
19 Correct 469 ms 1664 KB Output is correct
20 Correct 509 ms 1788 KB Output is correct
21 Correct 998 ms 1884 KB Output is correct
22 Correct 1747 ms 1792 KB Output is correct
23 Correct 1859 ms 1976 KB Output is correct
24 Correct 592 ms 2168 KB Output is correct
25 Correct 54 ms 2040 KB Output is correct
26 Correct 53 ms 2052 KB Output is correct
27 Correct 24 ms 2048 KB Output is correct
28 Correct 24 ms 2048 KB Output is correct
29 Correct 2582 ms 2036 KB Output is correct
30 Correct 73 ms 1908 KB Output is correct
31 Correct 50 ms 1908 KB Output is correct
32 Correct 69 ms 2040 KB Output is correct
33 Correct 517 ms 2168 KB Output is correct
34 Correct 49 ms 2040 KB Output is correct
35 Correct 50 ms 2040 KB Output is correct
36 Correct 51 ms 2040 KB Output is correct
37 Correct 53 ms 2040 KB Output is correct
38 Correct 864 ms 2296 KB Output is correct
39 Correct 697 ms 2108 KB Output is correct
40 Correct 553 ms 2168 KB Output is correct
41 Correct 2261 ms 1912 KB Output is correct
42 Correct 1516 ms 2052 KB Output is correct
43 Correct 1152 ms 2044 KB Output is correct
44 Correct 1515 ms 1908 KB Output is correct
45 Correct 732 ms 1784 KB Output is correct
46 Correct 465 ms 1912 KB Output is correct
47 Correct 1069 ms 2036 KB Output is correct
48 Correct 673 ms 1784 KB Output is correct
49 Correct 395 ms 2040 KB Output is correct