結果
問題 | No.1722 [Cherry 3rd Tune C] In my way |
ユーザー |
|
提出日時 | 2021-10-29 21:53:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 1,130 bytes |
コンパイル時間 | 3,786 ms |
コンパイル使用メモリ | 112,380 KB |
実行使用メモリ | 27,576 KB |
最終ジャッジ日時 | 2024-10-07 11:02:04 |
合計ジャッジ時間 | 5,223 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using static System.Console; using System.Linq; class yuki320 { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray(); static void Main() { var c = NList; var x = NList; var y = NList; Array.Sort(y); var res = new string[x.Length]; for (var i = 0; i < x.Length; ++i) { var pos = Pos(x[i], y); if (pos == y.Length) res[i] = "Infinity"; else res[i] = (y[pos] - x[i]).ToString(); } WriteLine(string.Join("\n", res)); } static int Pos(int val, int[] list) { if (val > list[list.Length - 1]) return list.Length; var ng = -1; var ok = list.Length - 1; while (ok - ng > 1) { var center = (ok + ng) / 2; if (val <= list[center]) ok = center; else ng = center; } return ok; } }