結果
問題 | No.2124 Guess the Permutation |
ユーザー | kpinkcat |
提出日時 | 2023-09-24 02:47:03 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 730 bytes |
コンパイル時間 | 1,770 ms |
コンパイル使用メモリ | 201,168 KB |
実行使用メモリ | 24,072 KB |
平均クエリ数 | 374.60 |
最終ジャッジ日時 | 2023-09-24 02:47:07 |
合計ジャッジ時間 | 2,993 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 24 ms
23,532 KB |
testcase_01 | AC | 19 ms
24,012 KB |
testcase_02 | AC | 20 ms
24,048 KB |
testcase_03 | AC | 19 ms
23,616 KB |
testcase_04 | AC | 21 ms
24,060 KB |
testcase_05 | AC | 23 ms
23,676 KB |
testcase_06 | AC | 35 ms
23,532 KB |
testcase_07 | AC | 47 ms
23,424 KB |
testcase_08 | AC | 48 ms
24,012 KB |
testcase_09 | AC | 56 ms
24,072 KB |
ソースコード
#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, tmp; cin >> n; vector<ll> a(n); all = n * (n+1)/2; for (ll i = 2; i < n; i++){ cout << "? " << i << " " << n << endl; cin >> tmp; a[i-2] = all - tmp; all = tmp; } cout << "? " << 1 << " " << n - 1 << endl; cin >> tmp; a[n-1] = n * (n+1)/2 - tmp; a[n-2] = all - a[n-1]; string delim = ""; cout << "! "; for (auto x : a){ cout << delim << x; delim = " "; } cout << endl; }