結果

問題 No.934 Explosive energy drink
ユーザー CleyLCleyL
提出日時 2019-11-29 22:22:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,131 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 76,032 KB
実行使用メモリ 35,180 KB
平均クエリ数 83.58
最終ジャッジ日時 2023-09-23 18:45:17
合計ジャッジ時間 5,664 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,712 KB
testcase_01 AC 190 ms
24,396 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

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; 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