結果
| 問題 | 
                            No.2124 Guess the Permutation
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-11-18 21:37:27 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,346 bytes | 
| コンパイル時間 | 1,766 ms | 
| コンパイル使用メモリ | 167,120 KB | 
| 実行使用メモリ | 25,220 KB | 
| 平均クエリ数 | 374.60 | 
| 最終ジャッジ日時 | 2024-09-20 02:01:37 | 
| 合計ジャッジ時間 | 2,688 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | AC * 6 WA * 3 | 
ソースコード
#define _DEB321UG
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const long double pi = acos(-1.0);
const int INF = 1987654321;
// const int MOD = 1e9;
// 
int psum[1004];
int arr[1004];
int used[1004];
int main(){
#ifdef _DEBUG
    freopen ("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif  
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    for(int i = 2; i <= N; i++){
        cout << "? " << 1 << " " << i << endl;
        cout.flush();
        if(i == 2){
            int sum12; cin >> sum12;
            psum[2] = sum12;
            continue;
        }
        // int x; cin >> x;
        cin >> psum[i];
        arr[i] = psum[i] - psum[i-1];
        used[arr[i]] = true;
    }    
    for(int i = 1; i <= N; i++){
        if(!used[i]){
            arr[1] = i;
            arr[2] = psum[2] - i;
            // used[i] = true;
            break;
        }
    }
    // for(int i = 1; i <= N; i++){
    //     if(!used[i]){
    //         arr[2] = i;
    //         used[i] = true;
    //         break;
    //     }
    // }
    
    cout << "! ";
    for(int i = 1; i <= N-1; i++) cout << arr[i] << " ";
    cout << arr[N];
    cout.flush();
    
    return 0;
}