結果

問題 No.909 たぴの配置
コンテスト
ユーザー hedwig100
提出日時 2020-04-10 16:21:21
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 253 ms / 3,000 ms
コード長 611 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,352 ms
コンパイル使用メモリ 20,440 KB
実行使用メモリ 43,404 KB
最終ジャッジ日時 2026-04-04 17:14:25
合計ジャッジ時間 6,331 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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