結果

問題 No.2124 Guess the Permutation
ユーザー kpinkcat
提出日時 2023-09-24 02:25:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 1,977 ms
コンパイル使用メモリ 196,148 KB
最終ジャッジ日時 2025-02-17 01:58:52
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 9
権限があれば一括ダウンロードができます

ソースコード

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 (int 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