結果

問題 No.1121 Social Distancing in Cinema
ユーザー neterukunneterukun
提出日時 2020-07-22 23:14:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,449 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 87,428 KB
最終ジャッジ日時 2023-09-05 04:12:58
合計ジャッジ時間 9,964 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
76,520 KB
testcase_01 AC 96 ms
76,452 KB
testcase_02 AC 107 ms
76,632 KB
testcase_03 AC 113 ms
80,968 KB
testcase_04 AC 107 ms
81,376 KB
testcase_05 AC 117 ms
81,352 KB
testcase_06 AC 112 ms
81,236 KB
testcase_07 AC 120 ms
81,264 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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 _ 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(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(MAX_LEN):
        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)
0