結果
問題 |
No.3260 岩井スターグラフ
|
ユーザー |
![]() |
提出日時 | 2025-09-06 13:22:58 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 1,137 ms / 2,000 ms |
コード長 | 2,587 bytes |
コンパイル時間 | 8,720 ms |
コンパイル使用メモリ | 171,544 KB |
実行使用メモリ | 238,860 KB |
最終ジャッジ日時 | 2025-09-06 13:24:14 |
合計ジャッジ時間 | 38,878 ms |
ジャッジサーバーID (参考情報) |
judge / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (103 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "InputX"; static List<string> GetInputList() { var WillReturn = new List<string>(); if (InputPattern == "Input1") { WillReturn.Add("4 3 3"); WillReturn.Add("0 3"); WillReturn.Add("11 12"); WillReturn.Add("3 4"); //3 //1 //4 } else if (InputPattern == "Input2") { WillReturn.Add("1000000 1000000 2"); WillReturn.Add("1000000 1000000000000"); WillReturn.Add("998244353 1000000007"); //2000000 //244360 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static long[] GetSplitArr(string pStr) { return (pStr == "" ? new string[0] : pStr.Split(' ')).Select(pX => long.Parse(pX)).ToArray(); } static long mY; static void Main() { List<string> InputList = GetInputList(); long[] wkArr = { }; Action<string> SplitAct = (pStr) => wkArr = GetSplitArr(pStr); SplitAct(InputList[0]); mY = wkArr[1]; foreach (string EachStr in InputList.Skip(1)) { SplitAct(EachStr); long MinNode = Math.Min(wkArr[0], wkArr[1]); long MaxNode = Math.Max(wkArr[0], wkArr[1]); if (MinNode == 0 && MaxNode == 0) { Console.WriteLine(0); continue; } if (MinNode == 0 && MaxNode != 0) { long UdeID, Kyori; DeriveInfo(MaxNode, out UdeID, out Kyori); Console.WriteLine(Kyori); continue; } long UdeID1, Kyori1; DeriveInfo(MinNode, out UdeID1, out Kyori1); long UdeID2, Kyori2; DeriveInfo(MaxNode, out UdeID2, out Kyori2); if (UdeID1 == UdeID2) { Console.WriteLine(Math.Abs(Kyori1-Kyori2)); continue; } if (UdeID1 != UdeID2) { Console.WriteLine(Kyori1 + Kyori2); continue; } } } // 0超えのノードを引数として、腕番号、0からの距離を返す static void DeriveInfo(long pNodeNo, out long pUdeID, out long pKyori) { pUdeID = (pNodeNo - 1) / mY; pKyori = pNodeNo % mY; if (pKyori == 0) pKyori = mY; } }