# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38265 | youngyojun | 별자리 2 (JOI14_constellation2) | C++11 | 9000 ms | 2072 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |