답안 #894654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
894654 2023-12-28T15:39:29 Z OAleksa Dragon 2 (JOI17_dragon2) C++14
60 / 100
4000 ms 4676 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
const int N = 3e4 + 69;
struct point {
	int x, y;
};
point a[N];
point s, e;
int n, m, d1, e1, d2, e2, q, c[N];
vector<point> g[N];
int cross(point a, point b, point c) {
	point v = {b.x - a.x, b.y - a.y};
	point v1 = {c.x - a.x, c.y - a.y};
	int r = v1.x * v.y - v1.y * v.x;
	assert(r != 0);
	if (r > 0)
		return 1; //desno
	return -1; //levo
}
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
  int tt = 1;
  //cin >> tt;
  while (tt--) {
		cin >> n >> m;
		for (int i = 1;i <= n;i++) {
			cin >> a[i].x >> a[i].y >> c[i];
			g[c[i]].push_back(a[i]);
		}
		cin >> s.x >> s.y >> e.x >> e.y;
		cin >> q;
		while (q--) {
			int a, b;
			cin >> a >> b;
			int ans = 0;
			for (auto u : g[a]) {
				for (auto t : g[b]) {
					//ili je u trouglu
					//ili se seku duzi
					if (cross(u, s, t) == cross(s, e, t) && cross(s, e, t) == cross(e, u, t))
						++ans;
					else if (cross(u, t, s) != cross(u, t, e) && cross(s, e, u) != cross(s, e, t))
						++ans;
				}
			}
			cout << ans << '\n';
		}
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 1372 KB Output is correct
2 Correct 35 ms 1368 KB Output is correct
3 Correct 43 ms 1372 KB Output is correct
4 Correct 29 ms 2140 KB Output is correct
5 Correct 20 ms 2384 KB Output is correct
6 Correct 3 ms 1628 KB Output is correct
7 Correct 2 ms 1372 KB Output is correct
8 Correct 10 ms 1372 KB Output is correct
9 Correct 11 ms 1384 KB Output is correct
10 Correct 12 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2079 ms 3140 KB Output is correct
2 Correct 3959 ms 3212 KB Output is correct
3 Correct 78 ms 3416 KB Output is correct
4 Correct 10 ms 3372 KB Output is correct
5 Correct 9 ms 3420 KB Output is correct
6 Correct 1495 ms 3228 KB Output is correct
7 Correct 1505 ms 3248 KB Output is correct
8 Correct 920 ms 3284 KB Output is correct
9 Correct 966 ms 2908 KB Output is correct
10 Correct 931 ms 3076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 1372 KB Output is correct
2 Correct 35 ms 1368 KB Output is correct
3 Correct 43 ms 1372 KB Output is correct
4 Correct 29 ms 2140 KB Output is correct
5 Correct 20 ms 2384 KB Output is correct
6 Correct 3 ms 1628 KB Output is correct
7 Correct 2 ms 1372 KB Output is correct
8 Correct 10 ms 1372 KB Output is correct
9 Correct 11 ms 1384 KB Output is correct
10 Correct 12 ms 1368 KB Output is correct
11 Correct 2079 ms 3140 KB Output is correct
12 Correct 3959 ms 3212 KB Output is correct
13 Correct 78 ms 3416 KB Output is correct
14 Correct 10 ms 3372 KB Output is correct
15 Correct 9 ms 3420 KB Output is correct
16 Correct 1495 ms 3228 KB Output is correct
17 Correct 1505 ms 3248 KB Output is correct
18 Correct 920 ms 3284 KB Output is correct
19 Correct 966 ms 2908 KB Output is correct
20 Correct 931 ms 3076 KB Output is correct
21 Correct 2059 ms 3224 KB Output is correct
22 Correct 3963 ms 3216 KB Output is correct
23 Correct 3539 ms 3548 KB Output is correct
24 Correct 860 ms 4436 KB Output is correct
25 Correct 42 ms 4556 KB Output is correct
26 Correct 30 ms 4676 KB Output is correct
27 Correct 13 ms 3676 KB Output is correct
28 Correct 11 ms 3672 KB Output is correct
29 Execution timed out 4003 ms 4504 KB Time limit exceeded
30 Halted 0 ms 0 KB -