# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38265 | 2018-01-03T09:03:37 Z | youngyojun | 별자리 2 (JOI14_constellation2) | C++11 | 9000 ms | 2072 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; ll operator * (const pll& A, const pll& B) { return A.first*B.second - B.first*A.second; } ll ccw(const pll& A, const pll& B, const pll& C) { return A*B + B*C + C*A; } const int MAXN = 3005; pll P[MAXN]; int A[MAXN]; ll Ans; int N; int main() { scanf("%d", &N); for(int i = 1; i <= N; i++) { scanf("%lld%lld", &P[i].first, &P[i].second); scanf("%d", &A[i]); } for(int i = 1; i < N; i++) for(int j = i+1; j <= N; j++) { int l[3] = {0, }, r[3] = {0, }; for(int k = 1; k <= N; k++) { if(k == i || k == j) continue; (ccw(P[i], P[j], P[k]) < 0 ? l : r)[A[k]]++; } int tmp1 = l[A[i]], tmp2 = r[A[j]]; l[A[i]] = r[A[j]] = 1; Ans += (ll)l[0] * l[1] * l[2] * r[0] * r[1] * r[2]; l[A[i]] = tmp1; r[A[j]] = tmp2; l[A[j]] = r[A[i]] = 1; Ans += (ll)l[0] * l[1] * l[2] * r[0] * r[1] * r[2]; } Ans /= 2; printf("%lld\n", Ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2072 KB | Output is correct |
2 | Correct | 0 ms | 2072 KB | Output is correct |
3 | Correct | 0 ms | 2072 KB | Output is correct |
4 | Correct | 0 ms | 2072 KB | Output is correct |
5 | Correct | 0 ms | 2072 KB | Output is correct |
6 | Correct | 0 ms | 2072 KB | Output is correct |
7 | Correct | 0 ms | 2072 KB | Output is correct |
8 | Correct | 0 ms | 2072 KB | Output is correct |
9 | Correct | 0 ms | 2072 KB | Output is correct |
10 | Correct | 0 ms | 2072 KB | Output is correct |
11 | Correct | 0 ms | 2072 KB | Output is correct |
12 | Correct | 0 ms | 2072 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2072 KB | Output is correct |
2 | Correct | 0 ms | 2072 KB | Output is correct |
3 | Correct | 3 ms | 2072 KB | Output is correct |
4 | Correct | 13 ms | 2072 KB | Output is correct |
5 | Correct | 29 ms | 2072 KB | Output is correct |
6 | Correct | 96 ms | 2072 KB | Output is correct |
7 | Correct | 99 ms | 2072 KB | Output is correct |
8 | Correct | 93 ms | 2072 KB | Output is correct |
9 | Correct | 93 ms | 2072 KB | Output is correct |
10 | Correct | 49 ms | 2072 KB | Output is correct |
11 | Correct | 93 ms | 2072 KB | Output is correct |
12 | Correct | 93 ms | 2072 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1896 ms | 2072 KB | Output is correct |
2 | Correct | 2803 ms | 2072 KB | Output is correct |
3 | Correct | 3973 ms | 2072 KB | Output is correct |
4 | Correct | 4053 ms | 2072 KB | Output is correct |
5 | Execution timed out | 9000 ms | 2072 KB | Execution timed out |
6 | Halted | 0 ms | 0 KB | - |