結果
| 問題 |
No.1997 X Lighting
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-01 22:49:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 632 bytes |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 82,704 KB |
| 実行使用メモリ | 131,044 KB |
| 最終ジャッジ日時 | 2024-11-26 06:26:28 |
| 合計ジャッジ時間 | 11,711 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 14 |
ソースコード
n,m = map(int,input().split())
XY = [list(map(int,input().split())) for i in range(m)]
S = [[[],[]] for i in range(2)]
for x,y in XY:
d = (x+y)%2
S[d][0].append(y-x)
S[d][1].append(x+y)
ans = 0
for t in range(2):
sp = set(S[t][0])
sm = set(S[t][1])
L = []
for p in sp:
ans += n-abs(p)
L.append([abs(p),1])
L.append([2*n-abs(p)+1,-1])
L.sort()
sm = sorted(sm)
count = 0
now = 0
for m in sm:
while now < len(L) and L[now][0] <= m:
count += L[now][1]
now += 1
base = n-abs(n+1-m)
ans += base-count
print(ans)