結果
問題 | No.1959 Prefix MinMax |
ユーザー |
![]() |
提出日時 | 2022-05-27 23:21:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 812 bytes |
コンパイル時間 | 416 ms |
コンパイル使用メモリ | 49,408 KB |
実行使用メモリ | 25,208 KB |
平均クエリ数 | 26.72 |
最終ジャッジ日時 | 2024-09-20 17:22:21 |
合計ジャッジ時間 | 3,031 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#include <cstdio>#include <vector>using namespace std;int main() {int T;scanf("%d", &T);while (T--) {fflush(stdout);int n;scanf("%d", &n);printf("? ");for (int i = 0; i < n - 1; i++) printf("%d ", i % 2);printf("\n");vector<int> b(n + 1);fflush(stdout);for (int i = 1; i <= n; i++) scanf("%d", &b[i]);printf("? ");for (int i = 0; i < n - 1; i++) printf("%d ", !(i % 2));printf("\n");fflush(stdout);vector<int> c(n + 1);for (int i = 1; i <= n; i++) scanf("%d", &c[i]);vector<int> a(n + 1);a[1] = b[1];for (int i = 2; i <= n; i++) {if (b[i] != b[i - 1]) a[i] = b[i];else a[i] = c[i];}printf("! ");for (int i = 1; i <= n; i++) printf("%d ", a[i]);printf("\n");}return 0;}