結果
| 問題 |
No.1121 Social Distancing in Cinema
|
| コンテスト | |
| ユーザー |
neterukun
|
| 提出日時 | 2020-07-22 23:07:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,441 bytes |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 82,484 KB |
| 実行使用メモリ | 107,152 KB |
| 最終ジャッジ日時 | 2024-06-23 00:29:25 |
| 合計ジャッジ時間 | 15,610 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 8 WA * 5 RE * 34 |
ソースコード
def in_10(x1, y1, x2, y2):
return (x1 - x2) ** 2 + (y1 - y2) ** 2 < 100
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
MAX_LEN = 500
is_seated = [[-1] * MAX_LEN for i in range(MAX_LEN)]
for i in range(n):
x, y = info[i]
x -= 1
y -= 1
is_seated[x][y] = i
dp = [[0] * MAX_LEN for i in range(MAX_LEN)]
ru = [0] * (MAX_LEN + 1)
for x in range(MAX_LEN):
for y in range(MAX_LEN):
if is_seated[x][y] == -1:
continue
else:
dp[x][y] = 1
dp[x][y] = max(ru[max(x + 1 - 10, 0)] + 1, dp[x][y])
for x2 in range(max(x - 10, 0), x):
for y2 in range(MAX_LEN):
if in_10(x, y, x2, y2):
continue
dp[x][y] = max(dp[x2][y2] + 1, dp[x][y])
for y2 in range(y):
if in_10(x, y, x, y2):
continue
dp[x][y] = max(dp[x][y2] + 1, dp[x][y])
tmp_max = 0
for y in range(n):
tmp_max = max(dp[x][y], tmp_max)
ru[x + 1] = max(ru[x], tmp_max)
max_ = 0
ans = []
for x in range(MAX_LEN)[::-1]:
for y in range(MAX_LEN)[::-1]:
if max_ == 0 and dp[x][y] > 0:
ans.append(is_seated[x][y] + 1)
max_ = dp[x][y]
elif max_ - 1 == dp[x][y] and dp[x][y] != 0:
ans.append(is_seated[x][y] + 1)
max_ = dp[x][y]
print(len(ans))
print(*ans)
neterukun