結果

問題 No.2124 Guess the Permutation
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-18 00:35:33
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 12,049 ms
コンパイル使用メモリ 161,024 KB
実行使用メモリ 47,812 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-18 00:35:48
合計ジャッジ時間 15,287 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
47,644 KB
testcase_01 AC 83 ms
47,652 KB
testcase_02 AC 85 ms
47,652 KB
testcase_03 AC 83 ms
47,664 KB
testcase_04 AC 84 ms
47,672 KB
testcase_05 AC 85 ms
47,680 KB
testcase_06 AC 101 ms
47,752 KB
testcase_07 AC 116 ms
47,812 KB
testcase_08 AC 118 ms
47,812 KB
testcase_09 AC 120 ms
47,808 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (102 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var ans = new int[n];
        var sum = n * (n + 1) / 2;
        var tmp = 0;
        for (var i = 1; i + 1 < n; ++i)
        {
            WriteLine($"? {i + 1} {n}");
            var s = NN;
            ans[i - 1] = sum - s - tmp;
            tmp += ans[i - 1];
        }
        WriteLine($"? 1 {n - 1}");
        ans[n - 1] = sum - NN;
        ans[n - 2] = sum - tmp - ans[n - 1];
        WriteLine($"! {string.Join(" ", ans)}");
    }
}
0