結果

問題 No.2753 鳩の巣原理
ユーザー 👑 kakel-sankakel-san
提出日時 2024-05-23 00:10:59
言語 C#
(.NET 8.0.203)
結果
RE  
実行時間 -
コード長 1,563 bytes
コンパイル時間 7,574 ms
コンパイル使用メモリ 166,588 KB
実行使用メモリ 54,080 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-23 00:11:28
合計ジャッジ時間 14,788 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
45,664 KB
testcase_01 RE -
testcase_02 AC 74 ms
46,200 KB
testcase_03 AC 75 ms
45,536 KB
testcase_04 AC 74 ms
45,260 KB
testcase_05 AC 74 ms
45,536 KB
testcase_06 RE -
testcase_07 AC 73 ms
45,152 KB
testcase_08 AC 75 ms
45,408 KB
testcase_09 AC 75 ms
45,656 KB
testcase_10 AC 75 ms
45,272 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 AC 75 ms
45,656 KB
testcase_15 AC 76 ms
45,144 KB
testcase_16 RE -
testcase_17 AC 74 ms
45,272 KB
testcase_18 AC 73 ms
44,996 KB
testcase_19 AC 74 ms
45,144 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 74 ms
45,656 KB
testcase_23 AC 74 ms
45,528 KB
testcase_24 AC 75 ms
45,528 KB
testcase_25 AC 75 ms
45,528 KB
testcase_26 AC 73 ms
45,272 KB
testcase_27 AC 74 ms
45,784 KB
testcase_28 AC 76 ms
45,508 KB
testcase_29 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static long[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => long.Parse(ReadLine())).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var min = 0;
        var icnt = 1;
        var max = n - 1;
        var acnt = n - 1;
        var query = 0;
        var i = 0;
        var j = 0;
        while (true)
        {
            var mid = (max + min) / 2;
            WriteLine($"? {mid + 1}");
            var dcnt = NN;
            ++query;
            if (max - min == 2)
            {
                if (icnt == dcnt)
                {
                    i = min;
                    j = mid;
                }
                else
                {
                    i = mid;
                    j = max;
                }
                break;
            }
            if (mid - min == dcnt - icnt)
            {
                min = mid;
                icnt = dcnt;
            }
            else
            {
                max = mid;
                acnt = dcnt;
            }
        }
        while (query < 10)
        {
            WriteLine("? 1");
            ReadLine();
            ++query;
        }
        WriteLine($"Yes {i + 1} {j + 1}");
    }
}
0