結果

問題 No.2252 Find Zero
ユーザー 👑 kakel-sankakel-san
提出日時 2023-03-24 22:50:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 4,670 ms
コンパイル使用メモリ 111,036 KB
実行使用メモリ 40,368 KB
平均クエリ数 78.17
最終ジャッジ日時 2023-10-18 21:23:45
合計ジャッジ時間 7,513 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
40,364 KB
testcase_01 AC 106 ms
40,364 KB
testcase_02 AC 81 ms
40,364 KB
testcase_03 AC 95 ms
40,364 KB
testcase_04 AC 81 ms
40,364 KB
testcase_05 AC 82 ms
40,364 KB
testcase_06 AC 82 ms
40,364 KB
testcase_07 AC 81 ms
40,364 KB
testcase_08 AC 89 ms
40,364 KB
testcase_09 AC 97 ms
40,368 KB
testcase_10 AC 80 ms
40,364 KB
testcase_11 AC 81 ms
40,364 KB
testcase_12 AC 82 ms
40,364 KB
testcase_13 AC 82 ms
40,364 KB
testcase_14 AC 83 ms
40,364 KB
testcase_15 AC 83 ms
40,364 KB
testcase_16 AC 81 ms
40,364 KB
testcase_17 AC 80 ms
40,364 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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 int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray();
    static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        for (var i = 0; i + 1 < n; i += 2)
        {
            WriteLine($"? {i} {i + 1}");
            var z = NN;
            if (z == i)
            {
                WriteLine($"! {i + 1}");
                return;
            }
            if (z == i + 1)
            {
                WriteLine($"! {i}");
                return;
            }
        }
        WriteLine($"! {n - 1}");
    }
}
0