結果

問題 No.934 Explosive energy drink
ユーザー polylogK
提出日時 2019-11-29 23:12:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 1,041 bytes
コンパイル時間 1,642 ms
コンパイル使用メモリ 169,692 KB
実行使用メモリ 25,220 KB
平均クエリ数 709.58
最終ジャッジ日時 2024-07-16 18:48:27
合計ジャッジ時間 6,750 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

bool query(std::vector<int> & q) {
	printf("? %d\n", q.size());
	for(int i = 0; i < q.size(); i++) printf("%d%c", q[i], " \n"[i == (int)q.size() - 1]);
	cout << std::flush;

	int ret; scanf("%d", &ret);
	return (ret == 1);
}

int main() {
	int n; scanf("%d", &n);
	
	std::vector<int> ans;
	for(int i = 0; i < n; i++) {
		std::vector<int> q;
		for(int j = 0; j < i; j++) q.push_back(j + 1);
		for(int j = i + 1; j < n; j++) q.push_back(j + 1);

		if(!query(q)) ans.push_back(i + 1);
	}
		
	printf("! %d\n", ans.size());
	for(int i = 0; i < ans.size(); i++) printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);
	cout << std::flush;
	return 0;
}
0