結果

問題 No.934 Explosive energy drink
ユーザー aajisakaaajisaka
提出日時 2019-12-15 03:03:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 2,008 bytes
コンパイル時間 3,959 ms
コンパイル使用メモリ 171,564 KB
実行使用メモリ 24,372 KB
平均クエリ数 709.08
最終ジャッジ日時 2023-09-23 19:17:55
合計ジャッジ時間 6,945 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
23,340 KB
testcase_01 AC 187 ms
23,472 KB
testcase_02 AC 27 ms
23,520 KB
testcase_03 AC 107 ms
24,228 KB
testcase_04 AC 313 ms
23,640 KB
testcase_05 AC 29 ms
23,568 KB
testcase_06 AC 28 ms
24,372 KB
testcase_07 AC 27 ms
23,484 KB
testcase_08 AC 27 ms
24,036 KB
testcase_09 AC 27 ms
24,240 KB
testcase_10 AC 27 ms
24,204 KB
testcase_11 AC 28 ms
23,532 KB
testcase_12 AC 29 ms
23,820 KB
testcase_13 AC 33 ms
23,964 KB
testcase_14 AC 33 ms
23,376 KB
testcase_15 AC 106 ms
23,820 KB
testcase_16 AC 41 ms
23,292 KB
testcase_17 AC 55 ms
23,568 KB
testcase_18 AC 58 ms
23,520 KB
testcase_19 AC 86 ms
23,580 KB
testcase_20 AC 137 ms
23,952 KB
testcase_21 AC 144 ms
24,216 KB
testcase_22 AC 186 ms
23,664 KB
testcase_23 AC 189 ms
24,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ExplosiveEnergyDrink {
public:

    set<int> ans;

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n;
#if LOCAL
      n = 4;
      ans.insert(2);
      ans.insert(4);
#else
      cin >> n;
#endif

      set<int> st;
      for(int i=1; i<=n; i++) {
        st.insert(i);
      }
      for(int i=1; i<=n; i++) {
        if (st.size() == 2) break;
        st.erase(i);
        cout << "? " << st.size() << endl;
        for(auto e: st) {
          cout << e << ' ';
        }

        cout << endl;
        int ret = 1;
#if LOCAL
        for(auto e: ans) {
          if (st.find(e) == st.end()) {
            ret = 0;
          }
        }
#else
        cin >> ret;
#endif
        if (ret==0) {
          st.insert(i);
        }
      }

      cout << "! " << st.size() << endl;
      for(auto e: st) {
        cout << e << ' ';
      }
      cout << endl;
    }
};

signed main() {
  ExplosiveEnergyDrink solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
0