結果

問題 No.2753 鳩の巣原理
ユーザー 👑 kakel-sankakel-san
提出日時 2024-05-23 00:08:44
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,495 bytes
コンパイル時間 9,258 ms
コンパイル使用メモリ 172,476 KB
実行使用メモリ 52,696 KB
平均クエリ数 11.73
最終ジャッジ日時 2024-05-23 00:09:05
合計ジャッジ時間 17,975 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (102 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 rest = 10;
        var i = 0;
        var j = 0;
        while (true)
        {
            var mid = (max + min) / 2;
            WriteLine($"? {mid + 1}");
            var dcnt = NN;
            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;
            }
            --rest;
        }
        while (rest > 0)
        {
            WriteLine("? 1");
            ReadLine();
            --rest;
        }
        WriteLine($"Yes {i + 1} {j + 1}");
    }
}
0