結果
問題 |
No.909 たぴの配置
|
ユーザー |
![]() |
提出日時 | 2019-10-18 10:56:41 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 1,014 ms / 3,000 ms |
コード長 | 1,496 bytes |
コンパイル時間 | 3,418 ms |
コンパイル使用メモリ | 104,448 KB |
実行使用メモリ | 50,432 KB |
最終ジャッジ日時 | 2024-06-25 14:31:53 |
合計ジャッジ時間 | 16,054 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.
ソースコード
using System; class Program { Scanner cin; int N; int[] X; int[] Y; void myon() { cin = new Scanner(); N = cin.nextInt(); X = new int[N]; Y = new int[N]; for(int i = 0; i < N; i++) { X[i] = cin.nextInt(); } for(int i = 0; i < N; i++) { Y[i] = cin.nextInt(); } int ret = X[0] + Y[0]; for(int i = 1; i < N; i++) { ret = Math.Min(ret, X[i] + Y[i]); } Console.WriteLine(ret); Console.WriteLine(ret); for(int i = 0; i < N; i++) { int more = X[i] + Y[i] - ret; int sub = Math.Min(more, X[i]); X[i] -= sub; more -= sub; Y[i] -= more; Console.WriteLine(Y[i]); } Console.WriteLine(0); } static void Main(string[] args) { new Program().myon(); } } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return next(); i = 0; return s[i++]; } public string nextLine() { return Console.ReadLine(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }