結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-09-24 02:47:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 117 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 1,874 ms |
| コンパイル使用メモリ | 195,520 KB |
| 最終ジャッジ日時 | 2025-02-17 02:01:29 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#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;
}
kpinkcat