提出 #27207087
ソースコード 拡げる
from functools import cmp_to_key
area = lambda x, y: 3 if y < 0 else 2 if x < 0 else 1
def arg_cmp(p, q):
ap = area(*p)
aq = area(*q)
if ap == aq:
px, py = p
qx, qy = q
z = px * qy - py * qx
return -1 if z > 0 else 1 if z < 0 else 0
else:
return -1 if ap < aq else 1
N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
points = [(x-1, y) for x, y in points]
points.sort(key=cmp_to_key(arg_cmp))
current = (1, 0)
ans = 0
for (x, y) in points:
if arg_cmp((x+1, y-1), current) >= 0:
ans += 1
current = (x, y)
print(ans)
提出情報
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 500 / 500 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, example0.txt, example1.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 000.txt | AC | 76 ms | 66952 KiB |
| 001.txt | AC | 1094 ms | 130440 KiB |
| 002.txt | AC | 1125 ms | 130572 KiB |
| 003.txt | AC | 1112 ms | 130640 KiB |
| 004.txt | AC | 1115 ms | 130540 KiB |
| 005.txt | AC | 497 ms | 97524 KiB |
| 006.txt | AC | 463 ms | 95276 KiB |
| 007.txt | AC | 292 ms | 85808 KiB |
| 008.txt | AC | 668 ms | 107456 KiB |
| 009.txt | AC | 1081 ms | 129924 KiB |
| 010.txt | AC | 1098 ms | 130292 KiB |
| 011.txt | AC | 1106 ms | 130228 KiB |
| 012.txt | AC | 1107 ms | 130296 KiB |
| 013.txt | AC | 1111 ms | 130548 KiB |
| 014.txt | AC | 789 ms | 113720 KiB |
| 015.txt | AC | 335 ms | 88212 KiB |
| 016.txt | AC | 1098 ms | 130144 KiB |
| 017.txt | AC | 1119 ms | 130292 KiB |
| 018.txt | AC | 1145 ms | 130176 KiB |
| 019.txt | AC | 1109 ms | 130252 KiB |
| 020.txt | AC | 852 ms | 116384 KiB |
| 021.txt | AC | 535 ms | 100040 KiB |
| 022.txt | AC | 1103 ms | 130244 KiB |
| 023.txt | AC | 1120 ms | 130424 KiB |
| 024.txt | AC | 1124 ms | 130384 KiB |
| 025.txt | AC | 1120 ms | 130360 KiB |
| 026.txt | AC | 1138 ms | 130308 KiB |
| 027.txt | AC | 1131 ms | 130224 KiB |
| 028.txt | AC | 1133 ms | 130196 KiB |
| 029.txt | AC | 1114 ms | 130336 KiB |
| 030.txt | AC | 1131 ms | 130224 KiB |
| 031.txt | AC | 1121 ms | 130388 KiB |
| 032.txt | AC | 1124 ms | 130464 KiB |
| 033.txt | AC | 448 ms | 126416 KiB |
| 034.txt | AC | 1080 ms | 129968 KiB |
| 035.txt | AC | 1130 ms | 129944 KiB |
| 036.txt | AC | 1124 ms | 130008 KiB |
| example0.txt | AC | 71 ms | 66904 KiB |
| example1.txt | AC | 58 ms | 67192 KiB |