結果

問題 No.1020 Reverse
ユーザー kshiva1126kshiva1126
提出日時 2020-05-24 00:09:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,280 KB
最終ジャッジ日時 2024-04-17 19:37:20
合計ジャッジ時間 4,385 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
16,128 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 WA -
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 47 ms
10,752 KB
testcase_06 AC 32 ms
10,752 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def reverse(first, end, l):
    if end - first == 1:
        middle = 1
    else:
        middle = (first + end) // 2

    for index, val in enumerate(range(first, middle)):
        tmp = l[val]
        l[val] = l[end - index]
        l[end - index] = tmp

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

for i in range(1, N - K + 1 + 1):
    reverse(i - 1, i + K - 1 - 1, l)

s = ''
for i in l:
    s += i

print(s)
0