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;
using ll = long long;
using lf = long double;
#define x first
#define y second
using Point = pair<ll, ll>;
Point operator+ (Point p, Point q) {return Point(p.x + q.x, p.y + q.y);}
Point operator- (Point p, Point q) {return Point(p.x - q.x, p.y - q.y);}
ll operator* (Point p, Point q) {return p.x * q.x + p.y * q.y;}
ll operator/ (Point p, Point q) {return p.x * q.y - q.x * p.y;}
ll CCW(Point p, Point q, Point r) {return (q - p) / (r - q);}
ll N;
Point A[3005];
ll T[3005];
int main(){
cin.tie(0) -> sync_with_stdio(false);
cin >> N;
for(int i = 1; i <= N; i++){
cin >> A[i].x >> A[i].y;
cin >> T[i];
}
ll ans = 0;
for(int i = 1; i <= N; i++){
for(int j = i + 1; j <= N; j++){
vector<ll> X(3), Y(3);
for(int k = 1; k <= N; k++){
if(k == i || k == j) continue;
ll C = CCW(A[i], A[k], A[j]);
if(C > 0){
X[T[k]]++;
} else {
Y[T[k]]++;
}
}
ll pxti = X[T[i]], pytj = Y[T[j]];
X[T[i]] = Y[T[j]] = 1;
ans += X[0] * X[1] * X[2] * Y[0] * Y[1] * Y[2];
X[T[i]] = pxti, Y[T[j]] = pytj;
X[T[j]] = Y[T[i]] = 1;
ans += X[0] * X[1] * X[2] * Y[0] * Y[1] * Y[2];
}
}
cout << ans / 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |