結果

問題 No.934 Explosive energy drink
ユーザー fura
提出日時 2020-05-06 03:22:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 445 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 2,821 ms
コンパイル使用メモリ 193,332 KB
最終ジャッジ日時 2025-01-10 07:07:44
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n; scanf("%d",&n);
      |                ~~~~~^~~~~~~~~
main.cpp:14:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 int res; scanf("%d",&res);
      |                          ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> ans;
	rep(i,n){
		printf("? %d\n",n-1);
		rep(j,n) if(j!=i) printf("%d%c",j+1,j<n-1&&(j<n-2||i<n-1)?' ':'\n');
		fflush(stdout);
		int res; scanf("%d",&res);
		if(res==0) ans.emplace_back(i);
	}

	printf("! %lu\n",ans.size());
	rep(i,ans.size()) printf("%d%c",ans[i]+1,i+1<ans.size()?' ':'\n');
	fflush(stdout);

	return 0;
}
0