結果

問題 No.934 Explosive energy drink
ユーザー CleyLCleyL
提出日時 2019-11-29 22:25:07
言語 C++14
(gcc 12.3.0 + boost 1.83.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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
25,196 KB
testcase_01 AC 210 ms
25,220 KB
testcase_02 WA -
testcase_03 AC 112 ms
25,476 KB
testcase_04 WA -
testcase_05 AC 25 ms
25,220 KB
testcase_06 AC 26 ms
24,836 KB
testcase_07 AC 26 ms
24,580 KB
testcase_08 AC 25 ms
25,092 KB
testcase_09 AC 25 ms
25,220 KB
testcase_10 WA -
testcase_11 AC 25 ms
24,836 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 40 ms
24,568 KB
testcase_17 AC 56 ms
25,220 KB
testcase_18 WA -
testcase_19 AC 93 ms
24,836 KB
testcase_20 AC 153 ms
25,092 KB
testcase_21 AC 151 ms
25,220 KB
testcase_22 AC 208 ms
24,580 KB
testcase_23 AC 211 ms
25,220 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);
    }
  }
  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