結果

問題 No.1959 Prefix MinMax
ユーザー 👑 kakel-sankakel-san
提出日時 2022-05-27 21:58:13
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 2,285 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 110,208 KB
実行使用メモリ 43,896 KB
平均クエリ数 14.44
最終ジャッジ日時 2023-10-20 20:14:15
合計ジャッジ時間 7,600 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
41,996 KB
testcase_01 AC 54 ms
41,996 KB
testcase_02 AC 55 ms
41,984 KB
testcase_03 AC 52 ms
41,984 KB
testcase_04 AC 53 ms
41,984 KB
testcase_05 AC 53 ms
41,984 KB
testcase_06 AC 56 ms
41,984 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 void Main()
    {
        var t = NN;
        for (var i = 0; i < t; ++i) Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = new int[n - 1];
        var res = new int[n];
        for (var c = 0; c < 10; ++c)
        {
            WriteLine("? " + string.Join(" ", a));
            var q = NList;
            var flg = true;
            for (var i = 0; i + 1 < n; ++i)
            {
                if (q[i] == q[i + 1])
                {
                    a[i] = 1 - a[i];
                    flg = false;
                    break;
                }
            }
            if (flg)
            {
                res = q;
                break;
            }
        }
        WriteLine("! " + string.Join(" ", res));
    }
    static void Judge()
    {
        var p = new int[] { 4, 7, 3, 1, 8, 9, 2, 6, 5 };
        WriteLine(p.Length);
        while (true)
        {
            var q = ReadLine().Split();
            if (q[0] == "?")
            {
                var a = new int[p.Length - 1];
                for (var i = 0; i < a.Length; ++i) a[i] = int.Parse(q[i + 1]);
                var b = new int[p.Length];
                b[0] = p[0];
                for (var i = 0; i + 1 < b.Length; ++i)
                {
                    if (a[i] == 0) b[i + 1] = Math.Min(b[i], p[i + 1]);
                    else b[i + 1] = Math.Max(b[i], p[i + 1]);
                }
                WriteLine(string.Join(" ", b));
            }
            else
            {
                var flg = true;
                for (var i = 0; i < p.Length; ++i)
                {
                    if (p[i] != int.Parse(q[i + 1]))
                    {
                        WriteLine("WRONG!!!");
                        flg = false;
                    }
                }
                if (flg)
                {
                    WriteLine("AC!");
                    return;
                }
            }
        }
    }
}
0