結果

問題 No.1121 Social Distancing in Cinema
ユーザー neterukunneterukun
提出日時 2020-07-22 23:19:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,669 bytes
コンパイル時間 934 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 87,344 KB
最終ジャッジ日時 2023-09-05 04:27:26
合計ジャッジ時間 9,111 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
76,332 KB
testcase_01 AC 94 ms
76,336 KB
testcase_02 AC 109 ms
81,000 KB
testcase_03 AC 110 ms
80,976 KB
testcase_04 AC 112 ms
81,216 KB
testcase_05 AC 111 ms
81,264 KB
testcase_06 AC 115 ms
81,364 KB
testcase_07 AC 118 ms
81,484 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):
    for y in range(MAX_LEN):
        if max_ < dp[x][y]:
            max_ = dp[x][y]
            ans = [is_seated[x][y] + 1]
          
for x in range(MAX_LEN)[::-1]:
    for y in range(MAX_LEN)[::-1]:
        if dp[x][y] == max_:
            break
        dp[x][y] = 0
    else:
        continue
    break

for x in range(MAX_LEN)[::-1]:
    for y in range(MAX_LEN)[::-1]:
        if 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