Submission #961069

# Submission time Handle Problem Language Result Execution time Memory
961069 2024-04-11T13:25:00 Z Pety Kućice (COCI21_kucice) C++14
0 / 110
1 ms 348 KB
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1e6+2;
const int mod = 1e9 + 7;

int n;
struct point {
  int x, y;
  point operator - (const point &other) const {
    return {x - other.x, y - other.y};
  }
};
using ll = long long;
point p[1002];

ll ccw (point a, point b) {
  return a.x * b.y - a.y * b.x;
}

bool cmp (point a, point b) {
  if ((a.x > 0) != (b.x > 0))
    return a.x < b.x;
  return ccw(a, b) > 0;
}
int pw[1002];

int main () 
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> n;
  pw[0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].x >> p[i].y;
    pw[i] = 2ll * pw[i - 1] % mod;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    vector<point>v;
    for (int j = 1; j <= n; j++)
      if (j != i)
        v.push_back(p[j] - p[i]);
    sort(v.begin(), v.end(), cmp);
    int j = 0;
    ll x = 0;
    for (int i = 0; i < n - 1; i++) {
      while (ccw(v[i], v[(j + 1) % (n - 1)]) > 0)
        j++;
      x = (x + pw[(j - i + (n - 1)) % (n - 1)]) % mod;
    }
    x = pw[n] - x;
    if (x < 0) x += mod;
    ans += x;
    if (ans >= mod) ans %= mod;
  }
  cout << (ans-n + mod) % mod;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -