結果

問題 No.1121 Social Distancing in Cinema
ユーザー neterukunneterukun
提出日時 2020-07-22 23:10:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,463 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 112,404 KB
最終ジャッジ日時 2023-09-05 04:00:53
合計ジャッジ時間 21,244 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

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(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)"""
0