結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
河城白露
|
| 提出日時 | 2023-05-06 13:11:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 640 bytes |
| コンパイル時間 | 848 ms |
| コンパイル使用メモリ | 83,236 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2024-11-23 21:30:08 |
| 合計ジャッジ時間 | 2,248 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#define ll long long
#define db double
using namespace std;
ll n,ans[2003];
int main() {
cin >> n;
ll sum = (n + 1) * n / 2;
for (ll i = n - 1;i >= 2;i--) {
cout << "? 1 " << i << endl;
ll x;
cin >> x;
ans[i + 1] = sum - x;
sum = x;
}
ll mx = sum;
sum = (n + 1) * n / 2;
cout << "? 2 " << n << endl;
ll k;
cin >> k;
ans[1] = sum - k;
ans[2] = mx - ans[1];
cout << "! ";
for (ll i = 1;i <= n;i++) {
cout << ans[i] << " ";
}
return 0;
}
河城白露