# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
551895 | 2022-04-21T20:40:31 Z | LucaDantas | Dragon 2 (JOI17_dragon2) | C++17 | 4000 ms | 2188 KB |
#pragma GCC optmize("unroll-loops") #include <bits/stdc++.h> using namespace std; constexpr int maxn = 30010; struct Pt { int x, y; Pt(int _x = 0, int _y = 0) : x(_x), y(_y) {} long long operator/(const Pt& o) const { return 1ll * x * o.y - 1ll * y * o.x; } Pt operator-(const Pt& o) const { return Pt(x-o.x, y-o.y); } }; bool cw(const Pt& a, const Pt& b, const Pt& c) { return (b-a)/(c-a) < 0; } bool ccw(const Pt& a, const Pt& b, const Pt& c) { return (b-a)/(c-a) > 0; } vector<Pt> tribe[maxn]; Pt v[2]; int main() { int n, m; scanf("%d %d", &n, &m); for(int i = 0; i < n; i++) { int a, b, t; scanf("%d %d %d", &a, &b, &t); tribe[t].push_back(Pt(a, b)); } for(int i = 0; i < 2; i++) { int a, b; scanf("%d %d", &a, &b); v[i] = Pt(a, b); } int q; scanf("%d", &q); while(q--) { int a, b; scanf("%d %d", &a, &b); int ans = 0; for(Pt p1 : tribe[a]) { if(ccw(p1, v[0], v[1])) swap(v[0], v[1]); for(Pt p2 : tribe[b]) ans += cw(p1, v[0], p2) && ccw(p1, v[1], p2); } printf("%d\n", ans); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 980 KB | Output is correct |
2 | Correct | 20 ms | 1076 KB | Output is correct |
3 | Correct | 24 ms | 1068 KB | Output is correct |
4 | Correct | 38 ms | 1196 KB | Output is correct |
5 | Correct | 31 ms | 1248 KB | Output is correct |
6 | Correct | 2 ms | 980 KB | Output is correct |
7 | Correct | 2 ms | 980 KB | Output is correct |
8 | Correct | 8 ms | 1048 KB | Output is correct |
9 | Correct | 6 ms | 980 KB | Output is correct |
10 | Correct | 9 ms | 1064 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 993 ms | 1480 KB | Output is correct |
2 | Correct | 1787 ms | 1344 KB | Output is correct |
3 | Correct | 46 ms | 1492 KB | Output is correct |
4 | Correct | 11 ms | 1364 KB | Output is correct |
5 | Correct | 12 ms | 1620 KB | Output is correct |
6 | Correct | 923 ms | 1236 KB | Output is correct |
7 | Correct | 930 ms | 1240 KB | Output is correct |
8 | Correct | 468 ms | 1236 KB | Output is correct |
9 | Correct | 472 ms | 1484 KB | Output is correct |
10 | Correct | 465 ms | 1368 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 980 KB | Output is correct |
2 | Correct | 20 ms | 1076 KB | Output is correct |
3 | Correct | 24 ms | 1068 KB | Output is correct |
4 | Correct | 38 ms | 1196 KB | Output is correct |
5 | Correct | 31 ms | 1248 KB | Output is correct |
6 | Correct | 2 ms | 980 KB | Output is correct |
7 | Correct | 2 ms | 980 KB | Output is correct |
8 | Correct | 8 ms | 1048 KB | Output is correct |
9 | Correct | 6 ms | 980 KB | Output is correct |
10 | Correct | 9 ms | 1064 KB | Output is correct |
11 | Correct | 993 ms | 1480 KB | Output is correct |
12 | Correct | 1787 ms | 1344 KB | Output is correct |
13 | Correct | 46 ms | 1492 KB | Output is correct |
14 | Correct | 11 ms | 1364 KB | Output is correct |
15 | Correct | 12 ms | 1620 KB | Output is correct |
16 | Correct | 923 ms | 1236 KB | Output is correct |
17 | Correct | 930 ms | 1240 KB | Output is correct |
18 | Correct | 468 ms | 1236 KB | Output is correct |
19 | Correct | 472 ms | 1484 KB | Output is correct |
20 | Correct | 465 ms | 1368 KB | Output is correct |
21 | Correct | 969 ms | 1236 KB | Output is correct |
22 | Correct | 1762 ms | 1392 KB | Output is correct |
23 | Correct | 1880 ms | 1740 KB | Output is correct |
24 | Correct | 524 ms | 1796 KB | Output is correct |
25 | Correct | 53 ms | 1652 KB | Output is correct |
26 | Correct | 49 ms | 1748 KB | Output is correct |
27 | Correct | 16 ms | 1912 KB | Output is correct |
28 | Correct | 17 ms | 1876 KB | Output is correct |
29 | Execution timed out | 4030 ms | 2188 KB | Time limit exceeded |
30 | Halted | 0 ms | 0 KB | - |