結果

問題 No.2124 Guess the Permutation
ユーザー mobchan
提出日時 2023-05-03 02:00:19
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 11,481 ms
コンパイル使用メモリ 167,128 KB
実行使用メモリ 47,064 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-11-21 12:16:04
合計ジャッジ時間 12,535 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (101 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 System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var total = 0;
        for (int i = 1; i <= N; i++)
        {
            total += i;
        }

        var list = new List<int>();
        for (int i = 1; i < N - 1; i++)
        {
            Console.WriteLine("? {0} {1}", i + 1, N);
            var input = int.Parse(Console.ReadLine());
            list.Add(total - input);
            total = input;
        }

        {
            Console.WriteLine("? {0} {1}", N - 2, N - 1);
            var input = int.Parse(Console.ReadLine());
            list.Add(input - list[N - 3]);
            list.Add(total - list[N - 2]);
        }

        Console.WriteLine("! {0}", String.Join(" ", list));
    }
}
0