結果

問題 No.909 たぴの配置
ユーザー hedwig100hedwig100
提出日時 2020-04-10 16:21:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 310 ms / 3,000 ms
コード長 611 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 40,852 KB
最終ジャッジ日時 2023-10-13 07:13:12
合計ジャッジ時間 6,813 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,356 KB
testcase_01 AC 16 ms
8,316 KB
testcase_02 AC 16 ms
8,236 KB
testcase_03 AC 16 ms
8,164 KB
testcase_04 AC 16 ms
8,276 KB
testcase_05 AC 286 ms
39,512 KB
testcase_06 AC 299 ms
40,672 KB
testcase_07 AC 276 ms
36,780 KB
testcase_08 AC 301 ms
39,608 KB
testcase_09 AC 310 ms
39,632 KB
testcase_10 AC 285 ms
38,328 KB
testcase_11 AC 283 ms
36,732 KB
testcase_12 AC 289 ms
39,444 KB
testcase_13 AC 301 ms
40,852 KB
testcase_14 AC 291 ms
36,852 KB
testcase_15 AC 284 ms
36,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  itertools import permutations

def main():
    n = int(input())
    ans = [0] * (n + 2)
    M = INF
    X = list(map(int,input().split()))
    Y = list(map(int,input().split()))
    for i in range(n):
        M = min(M,X[i] + Y[i])
    ans[n + 1] = M
    
    for i in range(n):
        x = X[i]
        y = Y[i]
        if x < y:
            ans[i + 1] = min(x,M)
        else:
            ans[i + 1] = max(M - y,0)
    print(M)
    print(*ans,sep = '\n')

if __name__ =='__main__':
    main()  
0