結果

問題 No.934 Explosive energy drink
ユーザー 👑 CleyLCleyL
提出日時 2019-11-29 22:25:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,140 bytes
コンパイル時間 923 ms
コンパイル使用メモリ 76,952 KB
実行使用メモリ 25,604 KB
平均クエリ数 707.75
最終ジャッジ日時 2024-07-16 18:37:15
合計ジャッジ時間 6,778 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
    }
  }
  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;
}
0