답안 #226263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
226263 2020-04-23T08:59:16 Z dolphingarlic Dragon 2 (JOI17_dragon2) C++14
100 / 100
2563 ms 3092 KB
#include <bits/stdc++.h>
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_t[30001];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m, q, x, y;
	cin >> n >> m;
	while (n--) {
		cin >> A.x >> A.y >> q;
		by_t[q].push_back(A);
	}
	cin >> A.x >> A.y >> B.x >> B.y;
	cin >> q;
	while (q--) {
		cin >> x >> y;
		m = 0;
		for (Point i : by_t[x]) for (Point j : by_t[y]) {
			if (ccw(i, A, B)) m += (ccw(i, A, j) && ccw(j, B, i));
			else m += (ccw(j, A, i) && ccw(i, B, j));
		}
		cout << m << '\n';
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 1152 KB Output is correct
2 Correct 25 ms 1152 KB Output is correct
3 Correct 32 ms 1280 KB Output is correct
4 Correct 41 ms 2048 KB Output is correct
5 Correct 41 ms 2048 KB Output is correct
6 Correct 7 ms 1280 KB Output is correct
7 Correct 7 ms 1280 KB Output is correct
8 Correct 12 ms 1152 KB Output is correct
9 Correct 11 ms 1152 KB Output is correct
10 Correct 11 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1041 ms 2460 KB Output is correct
2 Correct 1818 ms 2432 KB Output is correct
3 Correct 56 ms 2560 KB Output is correct
4 Correct 19 ms 2560 KB Output is correct
5 Correct 21 ms 2552 KB Output is correct
6 Correct 1043 ms 2468 KB Output is correct
7 Correct 1016 ms 2476 KB Output is correct
8 Correct 536 ms 2448 KB Output is correct
9 Correct 528 ms 2168 KB Output is correct
10 Correct 530 ms 2420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 1152 KB Output is correct
2 Correct 25 ms 1152 KB Output is correct
3 Correct 32 ms 1280 KB Output is correct
4 Correct 41 ms 2048 KB Output is correct
5 Correct 41 ms 2048 KB Output is correct
6 Correct 7 ms 1280 KB Output is correct
7 Correct 7 ms 1280 KB Output is correct
8 Correct 12 ms 1152 KB Output is correct
9 Correct 11 ms 1152 KB Output is correct
10 Correct 11 ms 1280 KB Output is correct
11 Correct 1041 ms 2460 KB Output is correct
12 Correct 1818 ms 2432 KB Output is correct
13 Correct 56 ms 2560 KB Output is correct
14 Correct 19 ms 2560 KB Output is correct
15 Correct 21 ms 2552 KB Output is correct
16 Correct 1043 ms 2468 KB Output is correct
17 Correct 1016 ms 2476 KB Output is correct
18 Correct 536 ms 2448 KB Output is correct
19 Correct 528 ms 2168 KB Output is correct
20 Correct 530 ms 2420 KB Output is correct
21 Correct 1026 ms 2428 KB Output is correct
22 Correct 1793 ms 2552 KB Output is correct
23 Correct 1943 ms 2804 KB Output is correct
24 Correct 584 ms 3064 KB Output is correct
25 Correct 63 ms 2808 KB Output is correct
26 Correct 53 ms 2680 KB Output is correct
27 Correct 24 ms 2688 KB Output is correct
28 Correct 25 ms 2688 KB Output is correct
29 Correct 2563 ms 2960 KB Output is correct
30 Correct 78 ms 2548 KB Output is correct
31 Correct 48 ms 2556 KB Output is correct
32 Correct 69 ms 2812 KB Output is correct
33 Correct 533 ms 2808 KB Output is correct
34 Correct 50 ms 2808 KB Output is correct
35 Correct 54 ms 2808 KB Output is correct
36 Correct 56 ms 3024 KB Output is correct
37 Correct 52 ms 2680 KB Output is correct
38 Correct 888 ms 2936 KB Output is correct
39 Correct 698 ms 2808 KB Output is correct
40 Correct 558 ms 2936 KB Output is correct
41 Correct 2241 ms 3032 KB Output is correct
42 Correct 1494 ms 2680 KB Output is correct
43 Correct 1137 ms 2692 KB Output is correct
44 Correct 1559 ms 3092 KB Output is correct
45 Correct 758 ms 2712 KB Output is correct
46 Correct 482 ms 2680 KB Output is correct
47 Correct 1072 ms 2560 KB Output is correct
48 Correct 680 ms 2552 KB Output is correct
49 Correct 427 ms 2680 KB Output is correct