結果

問題 No.2124 Guess the Permutation
ユーザー t98slidert98slider
提出日時 2022-11-18 21:51:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 612 bytes
コンパイル時間 3,221 ms
コンパイル使用メモリ 171,740 KB
実行使用メモリ 24,624 KB
平均クエリ数 1.00
最終ジャッジ日時 2023-10-20 06:41:11
合計ジャッジ時間 6,656 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int N, v2 = 0;
    cin >> N;
    vector<ll> a(N);
    vector<bool> used(N, false);
    for(int i = 0; i + 1 < N; i++){
        ll v;
        cout << "? " << 1 << " " << i + 1 << '\n';
        cin >> v;
        a[i] = v - (i >= 1 ? a[i - 1] : 0);
        used[a[i] - 1] = true;
    }
    int v = min_element(used.begin(), used.end()) - used.begin();
    a.back() = v + 1;
    cout << "!";
    for(int i = 0; i < N; i++){
        cout << " " << a[i];
    }
    cout << '\n';
}
0