# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
551896 | 2022-04-21T20:44:40 Z | LucaDantas | Dragon 2 (JOI17_dragon2) | C++17 | 4000 ms | 1972 KB |
#pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 980 KB | Output is correct |
2 | Correct | 11 ms | 980 KB | Output is correct |
3 | Correct | 15 ms | 1060 KB | Output is correct |
4 | Correct | 39 ms | 1248 KB | Output is correct |
5 | Correct | 41 ms | 1372 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 980 KB | Output is correct |
8 | Correct | 7 ms | 980 KB | Output is correct |
9 | Correct | 6 ms | 980 KB | Output is correct |
10 | Correct | 6 ms | 1064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 491 ms | 1476 KB | Output is correct |
2 | Correct | 934 ms | 1364 KB | Output is correct |
3 | Correct | 30 ms | 1504 KB | Output is correct |
4 | Correct | 13 ms | 1364 KB | Output is correct |
5 | Correct | 12 ms | 1540 KB | Output is correct |
6 | Correct | 492 ms | 1236 KB | Output is correct |
7 | Correct | 485 ms | 1236 KB | Output is correct |
8 | Correct | 448 ms | 1316 KB | Output is correct |
9 | Correct | 495 ms | 1484 KB | Output is correct |
10 | Correct | 470 ms | 1364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 980 KB | Output is correct |
2 | Correct | 11 ms | 980 KB | Output is correct |
3 | Correct | 15 ms | 1060 KB | Output is correct |
4 | Correct | 39 ms | 1248 KB | Output is correct |
5 | Correct | 41 ms | 1372 KB | Output is correct |
6 | Correct | 3 ms | 980 KB | Output is correct |
7 | Correct | 3 ms | 980 KB | Output is correct |
8 | Correct | 7 ms | 980 KB | Output is correct |
9 | Correct | 6 ms | 980 KB | Output is correct |
10 | Correct | 6 ms | 1064 KB | Output is correct |
11 | Correct | 491 ms | 1476 KB | Output is correct |
12 | Correct | 934 ms | 1364 KB | Output is correct |
13 | Correct | 30 ms | 1504 KB | Output is correct |
14 | Correct | 13 ms | 1364 KB | Output is correct |
15 | Correct | 12 ms | 1540 KB | Output is correct |
16 | Correct | 492 ms | 1236 KB | Output is correct |
17 | Correct | 485 ms | 1236 KB | Output is correct |
18 | Correct | 448 ms | 1316 KB | Output is correct |
19 | Correct | 495 ms | 1484 KB | Output is correct |
20 | Correct | 470 ms | 1364 KB | Output is correct |
21 | Correct | 467 ms | 1236 KB | Output is correct |
22 | Correct | 968 ms | 1404 KB | Output is correct |
23 | Correct | 961 ms | 1624 KB | Output is correct |
24 | Correct | 294 ms | 1712 KB | Output is correct |
25 | Correct | 69 ms | 1692 KB | Output is correct |
26 | Correct | 44 ms | 1804 KB | Output is correct |
27 | Correct | 15 ms | 1920 KB | Output is correct |
28 | Correct | 16 ms | 1972 KB | Output is correct |
29 | Execution timed out | 4057 ms | 1784 KB | Time limit exceeded |
30 | Halted | 0 ms | 0 KB | - |