結果
問題 |
No.1187 皇帝ペンギン
|
ユーザー |
|
提出日時 | 2025-05-06 22:17:36 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 77 ms / 1,000 ms |
コード長 | 957 bytes |
コンパイル時間 | 7,917 ms |
コンパイル使用メモリ | 173,976 KB |
実行使用メモリ | 44,960 KB |
平均クエリ数 | 15.94 |
最終ジャッジ日時 | 2025-05-06 22:18:00 |
合計ジャッジ時間 | 15,126 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 54 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (117 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var ok = 0; var ng = 1003; while (ng - ok > 1) { var mid = (ok + ng) / 2; if (IsSafe(mid)) ok = mid; else { if (IsSafe(mid + 1)) ok = mid; else ng = mid; } } WriteLine("! " + ok); } static Dictionary<int, bool> dic = new Dictionary<int, bool>(); static bool IsSafe(int n) { if (dic.ContainsKey(n)) return dic[n]; WriteLine($"? {n}"); var res = ReadLine() == "safe"; dic[n] = res; return res; } }