結果

問題 No.909 たぴの配置
ユーザー hedwig100
提出日時 2020-04-10 16:21:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 402 ms / 3,000 ms
コード長 611 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 41,032 KB
最終ジャッジ日時 2024-09-15 04:29:09
合計ジャッジ時間 6,900 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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