結果
| 問題 | No.934 Explosive energy drink | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-11-29 22:04:40 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 334 ms / 2,000 ms | 
| コード長 | 718 bytes | 
| コンパイル時間 | 1,767 ms | 
| コンパイル使用メモリ | 169,028 KB | 
| 実行使用メモリ | 25,220 KB | 
| 平均クエリ数 | 709.58 | 
| 最終ジャッジ日時 | 2024-07-16 18:24:06 | 
| 合計ジャッジ時間 | 6,194 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int except_query(int a, int n) {
    cout << "? " << n-1 << "\n";
    int count = 0;
    for (int i = 1; i <= n; i++) {
        if (i == a) continue;
        if (count) cout << " ";
        cout << i;
        count++;
    }
    cout << "\n" << flush;
    int ans; cin >> ans;
    return ans;
}
void answer(vector<int> &ans) {
    cout << "! " << ans.size() << "\n";
    for (int i = 0; i < ans.size(); i++) {
        if (i) cout << " ";
        cout << ans[i];
    }
    cout << "\n";
}
int main() {
    int n; cin >> n;
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
        if (!except_query(i, n)) ans.emplace_back(i);
    }
    answer(ans);
    return 0;
}
            
            
            
        