結果

問題 No.909 たぴの配置
ユーザー bluemegane
提出日時 2021-10-08 07:39:43
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 228 ms / 3,000 ms
コード長 894 bytes
コンパイル時間 1,110 ms
コンパイル使用メモリ 113,476 KB
実行使用メモリ 64,276 KB
最終ジャッジ日時 2024-07-23 03:17:05
合計ジャッジ時間 6,384 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var x = Array.ConvertAll(line, long.Parse);
        line = Console.ReadLine().Trim().Split(' ');
        var y = Array.ConvertAll(line, long.Parse);
        getAns(n, x, y);
    }
    static void getAns(int n, long[] x, long[] y)
    {
        var xy = new long[n];
        for (int i = 0; i < n; i++) xy[i] = x[i] + y[i];
        var xymin = xy.Min();
        var ans = new long[n];
        if (xymin == 0) goto next;
        for (int i = 0; i < n; i++)
        {
            ans[i] = x[i] * xymin / xy[i];
        }
    next:;
        Console.WriteLine(xymin);
        Console.WriteLine(0);
        Console.WriteLine(string.Join("\n", ans));
        Console.WriteLine(xymin);
    }
}
0