結果

問題 No.2124 Guess the Permutation
ユーザー kpinkcatkpinkcat
提出日時 2023-09-24 02:28:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 201,072 KB
実行使用メモリ 24,408 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-09-24 02:28:11
合計ジャッジ時間 3,319 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;


int main()
{
    ll n, all;
    cin >> n;
    vector<ll> a(n);
    all = n * (n+1)/2;
    for (ll i = 2; i <= n; i++){
        ll tmp;
        cout << "? " << i << " " << n << endl;
        cin >> tmp;
        a[i-2] = all - tmp;
        all = tmp;
    }
    a[n-1] = all;
    string delim = "";
    cout << "! ";
    for (auto x : a){
        cout << delim << x;
        delim = " ";
    }
    cout << endl;
}
0