結果

問題 No.934 Explosive energy drink
ユーザー CleyLCleyL
提出日時 2019-11-29 22:26:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 1,151 bytes
コンパイル時間 1,577 ms
コンパイル使用メモリ 77,516 KB
実行使用メモリ 24,408 KB
平均クエリ数 709.42
最終ジャッジ日時 2023-09-23 18:47:27
合計ジャッジ時間 5,272 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,712 KB
testcase_01 AC 190 ms
23,928 KB
testcase_02 AC 24 ms
23,544 KB
testcase_03 AC 102 ms
24,024 KB
testcase_04 AC 315 ms
23,640 KB
testcase_05 AC 23 ms
23,688 KB
testcase_06 AC 23 ms
24,108 KB
testcase_07 AC 23 ms
24,300 KB
testcase_08 AC 23 ms
23,448 KB
testcase_09 AC 24 ms
23,544 KB
testcase_10 AC 25 ms
23,652 KB
testcase_11 AC 24 ms
24,336 KB
testcase_12 AC 25 ms
23,916 KB
testcase_13 AC 29 ms
23,484 KB
testcase_14 AC 31 ms
24,300 KB
testcase_15 AC 103 ms
24,024 KB
testcase_16 AC 39 ms
24,024 KB
testcase_17 AC 51 ms
24,084 KB
testcase_18 AC 55 ms
23,652 KB
testcase_19 AC 83 ms
23,748 KB
testcase_20 AC 134 ms
24,408 KB
testcase_21 AC 138 ms
24,084 KB
testcase_22 AC 190 ms
23,436 KB
testcase_23 AC 191 ms
23,928 KB
権限があれば一括ダウンロードができます

ソースコード

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