Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef unsigned int ui;
- typedef long long ll;
- typedef long double ld;
- const int MAXN = 777;
- ll M = 1000003;
- struct pnt {
- ll x;
- ll y;
- };
- pnt a[MAXN];
- ll v(pnt a, pnt b) {
- return a.x * b.y - b.x * a.y;
- }
- ll S(pnt a, pnt b, pnt c) {
- ll s = v({c.x - b.x, c.y - b.y}, {a.x - b.x, a.y - b.y});
- return (s);
- }
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int t;
- cin >> t;
- int z = 0;
- while (t > 0) {
- int n;
- cin >> n;
- for (int i = 0; i < n; ++i) {
- cin >> a[i].x >> a[i].y;
- }
- ll s = 0;
- for (int i = 0; i < n; ++i) {
- for (int j = i + 1; j < n; ++j) {
- ll s1 = 0;
- ll s2 = 0;
- ll c1 = 0, c2 = 0;
- for (int k = 0; k < n; ++k) {
- if (k == i || k == j) continue;
- ll x = S(a[j], a[k], a[i]) / 2;
- if (x > 0) {
- s1 += x;
- c1++;
- }
- if (x < 0) {
- s2 += x;
- c2++;
- }
- }
- if (c1 && c2) {
- s = s + s1 * c2 - s2 * c1;
- s %= M;
- }
- }
- }
- cout << "Case " << ++z << ": " << s % M << '\n';
- t--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement