結果

問題 No.2603 Tone Correction
ユーザー ニックネームニックネーム
提出日時 2024-01-13 02:18:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 157,464 KB
最終ジャッジ日時 2024-01-13 02:18:58
合計ジャッジ時間 7,267 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,332 KB
testcase_01 AC 34 ms
53,332 KB
testcase_02 AC 34 ms
53,332 KB
testcase_03 AC 41 ms
61,952 KB
testcase_04 AC 40 ms
61,952 KB
testcase_05 AC 41 ms
61,952 KB
testcase_06 AC 40 ms
61,952 KB
testcase_07 AC 41 ms
61,952 KB
testcase_08 AC 40 ms
61,952 KB
testcase_09 AC 42 ms
61,952 KB
testcase_10 AC 54 ms
61,952 KB
testcase_11 AC 52 ms
61,952 KB
testcase_12 AC 42 ms
61,952 KB
testcase_13 AC 216 ms
157,464 KB
testcase_14 AC 184 ms
156,956 KB
testcase_15 AC 186 ms
157,212 KB
testcase_16 AC 182 ms
157,212 KB
testcase_17 AC 183 ms
157,208 KB
testcase_18 AC 181 ms
156,824 KB
testcase_19 AC 207 ms
156,696 KB
testcase_20 AC 185 ms
157,084 KB
testcase_21 AC 185 ms
157,080 KB
testcase_22 AC 187 ms
157,336 KB
testcase_23 AC 164 ms
130,776 KB
testcase_24 AC 168 ms
130,776 KB
testcase_25 AC 192 ms
131,160 KB
testcase_26 AC 166 ms
130,904 KB
testcase_27 AC 165 ms
131,160 KB
testcase_28 AC 167 ms
131,284 KB
testcase_29 AC 163 ms
130,780 KB
testcase_30 AC 175 ms
130,908 KB
testcase_31 AC 164 ms
131,284 KB
testcase_32 AC 198 ms
131,288 KB
testcase_33 AC 32 ms
53,332 KB
testcase_34 AC 172 ms
155,444 KB
testcase_35 AC 152 ms
155,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = [0]+list(map(int,input().split()))+[0]
b = [0]+list(map(int,input().split()))+[0]
d = sorted((b[i+1]-a[i+1]-b[i]+a[i])%m for i in range(n+1))
c = sum(d)//m
print((sum(d[:-c])+c*m-sum(d[-c:]))//2)
0