Submission #6325715
Source Code Expand
import sys input = sys.stdin.readline from fractions import gcd from collections import Counter """ 適当に部分集合Xをとり、凸包 S として、Sに1点計上すればよい これだと2^N点得られる ただし、凸包の面積が0となる場合が例外 空集合、1点の場合と、線分の場合を除外する """ MOD = 998244353 N = int(input()) XY = [[int(x) for x in input().split()] for _ in range(N)] answer = pow(2,N,MOD) answer -= N + 1# 空、1点 for i,(x,y) in enumerate(XY): # i を選び、i+1番目以上のうちいくつかを選んで線分とする pts = [] for x1, y1 in XY[i+1:]: dx, dy = x1-x, y1-y g = gcd(dx, dy) dx //= g dy //= g # 標準化 if dx < 0: dx, dy = -dx, -dy elif dx == 0: dy = 1 pts.append((dx,dy)) c = Counter(pts) for v in c.values(): answer -= pow(2,v,MOD) - 1 answer %= MOD print(answer)
Submission Info
Submission Time | |
---|---|
Task | E - ConvexScore |
User | maspy |
Language | Python (3.4.3) |
Score | 700 |
Code Size | 1010 Byte |
Status | AC |
Exec Time | 83 ms |
Memory | 5112 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 35 ms | 5076 KiB |
0_001.txt | AC | 35 ms | 5076 KiB |
0_002.txt | AC | 35 ms | 5076 KiB |
1_003.txt | AC | 35 ms | 5076 KiB |
1_004.txt | AC | 35 ms | 5076 KiB |
1_005.txt | AC | 54 ms | 5076 KiB |
1_006.txt | AC | 36 ms | 5076 KiB |
1_007.txt | AC | 57 ms | 5076 KiB |
1_008.txt | AC | 52 ms | 5076 KiB |
1_009.txt | AC | 54 ms | 5076 KiB |
1_010.txt | AC | 42 ms | 5076 KiB |
1_011.txt | AC | 57 ms | 5076 KiB |
1_012.txt | AC | 59 ms | 5076 KiB |
1_013.txt | AC | 50 ms | 5076 KiB |
1_014.txt | AC | 36 ms | 5076 KiB |
1_015.txt | AC | 48 ms | 5076 KiB |
1_016.txt | AC | 41 ms | 5076 KiB |
1_017.txt | AC | 83 ms | 5112 KiB |
1_018.txt | AC | 82 ms | 5112 KiB |
1_019.txt | AC | 68 ms | 5076 KiB |
1_020.txt | AC | 67 ms | 5076 KiB |
1_021.txt | AC | 70 ms | 5076 KiB |
1_022.txt | AC | 72 ms | 5076 KiB |
1_023.txt | AC | 74 ms | 5112 KiB |
1_024.txt | AC | 71 ms | 5112 KiB |
1_025.txt | AC | 69 ms | 5076 KiB |
1_026.txt | AC | 71 ms | 5076 KiB |
1_027.txt | AC | 53 ms | 5076 KiB |
1_028.txt | AC | 54 ms | 5076 KiB |
1_029.txt | AC | 77 ms | 5112 KiB |
1_030.txt | AC | 80 ms | 5112 KiB |
1_031.txt | AC | 80 ms | 5112 KiB |
1_032.txt | AC | 81 ms | 5112 KiB |
1_033.txt | AC | 81 ms | 5112 KiB |
1_034.txt | AC | 77 ms | 5112 KiB |
1_035.txt | AC | 69 ms | 5076 KiB |