結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,136 KB
testcase_01 AC 87 ms
75,840 KB
testcase_02 AC 94 ms
76,304 KB
testcase_03 AC 97 ms
76,132 KB
testcase_04 AC 98 ms
76,488 KB
testcase_05 AC 103 ms
80,864 KB
testcase_06 AC 105 ms
80,988 KB
testcase_07 AC 105 ms
81,156 KB
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 AC 94 ms
76,392 KB
権限があれば一括ダウンロードができます

ソースコード

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