# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127910 | 2019-07-10T08:24:21 Z | 김세빈(#3108) | Dragon 2 (JOI17_dragon2) | C++14 | 198 ms | 48376 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <ll, ll> pll; struct point{ ll x, y; point() {} point(ll x, ll y) : x(x), y(y) {} point operator - (point p) { return point(x - p.x, y - p.y); } ll operator * (point p) { return x * p.y - y * p.x; } }; point P[3030]; ll D[3030][3030], C[3030]; point p1, p2; ll n, m; ll ccw(point &pa, point &pb, point &pc) { return (pb - pa) * (pc - pa); } int main() { ll q, i, j, a, b; scanf("%lld%lld", &n, &m); for(i=1; i<=n; i++){ scanf("%lld%lld%lld", &P[i].x, &P[i].y, C + i); } scanf("%lld%lld%lld%lld", &p1.x, &p1.y, &p2.x, &p2.y); for(i=1; i<=n; i++){ for(j=1; j<=n; j++){ if(C[i] == C[j]) continue; if(((ccw(P[i], p1, p2) > 0) == (ccw(P[i], p1, P[j]) > 0)) && ((ccw(P[i], p1, P[j]) > 0) == (ccw(P[i], P[j], p2) > 0))){ D[C[i]][C[j]] ++; } } } scanf("%lld", &q); for(; q--; ){ scanf("%lld%lld", &a, &b); printf("%lld\n", D[a][b]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 376 KB | Output is correct |
2 | Correct | 107 ms | 504 KB | Output is correct |
3 | Correct | 111 ms | 888 KB | Output is correct |
4 | Correct | 147 ms | 11836 KB | Output is correct |
5 | Correct | 198 ms | 48376 KB | Output is correct |
6 | Correct | 75 ms | 2296 KB | Output is correct |
7 | Correct | 74 ms | 2224 KB | Output is correct |
8 | Correct | 75 ms | 376 KB | Output is correct |
9 | Correct | 27 ms | 376 KB | Output is correct |
10 | Correct | 30 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4 ms | 376 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 376 KB | Output is correct |
2 | Correct | 107 ms | 504 KB | Output is correct |
3 | Correct | 111 ms | 888 KB | Output is correct |
4 | Correct | 147 ms | 11836 KB | Output is correct |
5 | Correct | 198 ms | 48376 KB | Output is correct |
6 | Correct | 75 ms | 2296 KB | Output is correct |
7 | Correct | 74 ms | 2224 KB | Output is correct |
8 | Correct | 75 ms | 376 KB | Output is correct |
9 | Correct | 27 ms | 376 KB | Output is correct |
10 | Correct | 30 ms | 376 KB | Output is correct |
11 | Execution timed out | 4 ms | 376 KB | Time limit exceeded (wall clock) |
12 | Halted | 0 ms | 0 KB | - |