제출 #961069

#제출 시각아이디문제언어결과실행 시간메모리
961069PetyKućice (COCI21_kucice)C++14
0 / 110
1 ms348 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...