結果

問題 No.1748 Parking Lot
ユーザー 👑 KazunKazun
提出日時 2021-11-19 21:34:44
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 71,492 KB
最終ジャッジ日時 2023-08-30 07:36:31
合計ジャッジ時間 3,376 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,112 KB
testcase_01 AC 71 ms
71,308 KB
testcase_02 AC 70 ms
71,328 KB
testcase_03 AC 69 ms
71,368 KB
testcase_04 AC 70 ms
71,244 KB
testcase_05 AC 69 ms
71,392 KB
testcase_06 AC 71 ms
71,252 KB
testcase_07 AC 70 ms
71,464 KB
testcase_08 AC 70 ms
71,288 KB
testcase_09 AC 71 ms
71,272 KB
testcase_10 AC 70 ms
71,164 KB
testcase_11 AC 69 ms
71,424 KB
testcase_12 AC 70 ms
71,072 KB
testcase_13 AC 71 ms
71,492 KB
testcase_14 AC 71 ms
71,448 KB
testcase_15 AC 69 ms
71,064 KB
testcase_16 AC 69 ms
71,288 KB
testcase_17 AC 68 ms
71,324 KB
testcase_18 AC 69 ms
71,364 KB
testcase_19 AC 69 ms
71,276 KB
testcase_20 AC 69 ms
71,132 KB
testcase_21 AC 69 ms
71,276 KB
testcase_22 AC 69 ms
71,364 KB
testcase_23 AC 70 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def greedy(N,K):
    X=[0]*(N+1); X[K]=1
    S=[K]

    for _ in range(N-1):
        alpha=-1; I=0
        for k in range(1,N+1):
            if X[k]==1:
                continue

            beta=float("inf")
            for a in S:
                beta=min(beta,abs(k-a))

            if alpha<beta:
                alpha=beta
                I=k

        S.append(I)
    return S

N,K=map(int,input().split())

"""
for K in range(1,N+1):
    print(greedy(N,K))
"""

if N==1:
    print(1)
else:
    print(N-1 if K!=N-1 else N)
0