結果
| 問題 | No.934 Explosive energy drink | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2019-11-29 22:26:41 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 339 ms / 2,000 ms | 
| コード長 | 1,151 bytes | 
| コンパイル時間 | 822 ms | 
| コンパイル使用メモリ | 76,780 KB | 
| 実行使用メモリ | 25,460 KB | 
| 平均クエリ数 | 709.42 | 
| 最終ジャッジ日時 | 2024-07-16 18:37:32 | 
| 合計ジャッジ時間 | 4,511 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> ans;
  for(int i = 1; n-i+ans.size() > 1 && n >= i; i++){
    cout << "? " << n-i+ans.size() << endl;
    for(int j = 0; ans.size() > j; j++){
      cout << ans[j];
      if(j+1 != ans.size()+n-i)cout << " ";
    }
    for(int j = i; n > j; j++){
      cout << j+1;
      if(j+1 != n)cout << " ";
    }
    cout << endl;
    int z;cin>>z;
    if(z == 0){
      ans.push_back(i);
    }
  }
  if(ans.size() == 0){
    ans.push_back(n-1);
    ans.push_back(n);
  }else if(ans.size() == 1){
    cout << "? 2" << endl;
    cout << ans[0] << " " << n-1 << endl;
    int z;cin>>z;
    if(z == 0){
      cout << "? 2" << endl;
      cout << ans[0] << " " << n << endl;
      cin>>z;
      if(z == 0){
        ans.push_back(n-1);
        ans.push_back(n);
      }else{
        ans.push_back(n);
      }
    }else{
      ans.push_back(n-1);
    }
  }else{
  }
  sort(ans.begin(),ans.end());
  cout << "! " << ans.size() << endl;
  for(int i = 0; ans.size() > i; i++){
    cout << ans[i];
    if(i+1 != i)cout << " ";
  }
  cout << endl;
}
            
            
            
        