結果

問題 No.2124 Guess the Permutation
ユーザー hatsuka_iwahatsuka_iwa
提出日時 2023-01-02 22:25:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 459 bytes
コンパイル時間 1,668 ms
コンパイル使用メモリ 169,396 KB
実行使用メモリ 25,220 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-05-05 06:40:40
合計ジャッジ時間 3,144 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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>
using namespace std;

int main() {
  int N, S, sum = 0; cin >> N;
  vector<int> Answer;

  for (int i = 2; i <= N; i++) {
    cout << "? " << i << ' ' << N << endl;
    cin >> S;
    Answer.push_back((N + 1) * N / 2 - S - sum);
    sum += Answer.at(i - 2);
  }

  cout << "! ";
  for (int i = 0; i < (int)Answer.size(); i++) {
    if (i > 0) cout << ' ';
    cout << Answer.at(i);
  }
  cout << ' ' << (N + 1) * N / 2 - sum << endl;
}
0