結果
問題 | No.934 Explosive energy drink |
ユーザー |
![]() |
提出日時 | 2019-11-29 23:53:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 320 ms / 2,000 ms |
コード長 | 1,098 bytes |
コンパイル時間 | 973 ms |
コンパイル使用メモリ | 83,576 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 709.58 |
最終ジャッジ日時 | 2024-07-16 18:53:56 |
合計ジャッジ時間 | 5,492 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function ‘int query(int, int)’: main.cpp:50:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 50 | scanf("%d", &a); | ~~~~~^~~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:58:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 58 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 934.cc: No.934 Explosive energy drink - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_N = 1000; /* typedef */ /* global variables */ int bs[MAX_N]; /* subroutines */ int query(int n, int i) { printf("? %d\n", n - 1); for (int j = 0, cont = 0; j < n; j++) if (j != i) { if (cont) putchar(' '); printf("%d", j + 1); cont = 1; } putchar('\n'); fflush(stdout); int a; scanf("%d", &a); return a; } /* main */ int main() { int n; scanf("%d", &n); int k = 0; for (int i = 0; i < n; i++) if (query(n, i) == 0) bs[k++] = i; printf("! %d\n", k); for (int i = 0; i < k; i++) { if (i) putchar(' '); printf("%d", bs[i] + 1); } putchar('\n'); fflush(stdout); return 0; }