結果

問題 No.1959 Prefix MinMax
ユーザー Drice27149Drice27149
提出日時 2022-05-27 23:21:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 49,280 KB
実行使用メモリ 24,684 KB
平均クエリ数 26.72
最終ジャッジ日時 2023-10-20 21:25:33
合計ジャッジ時間 3,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
24,672 KB
testcase_01 AC 24 ms
24,672 KB
testcase_02 AC 21 ms
24,672 KB
testcase_03 AC 24 ms
24,672 KB
testcase_04 AC 22 ms
24,672 KB
testcase_05 AC 21 ms
24,672 KB
testcase_06 AC 23 ms
24,672 KB
testcase_07 AC 33 ms
24,672 KB
testcase_08 AC 34 ms
24,672 KB
testcase_09 AC 33 ms
24,672 KB
testcase_10 AC 33 ms
24,672 KB
testcase_11 AC 35 ms
24,672 KB
testcase_12 AC 35 ms
24,672 KB
testcase_13 AC 36 ms
24,672 KB
testcase_14 AC 36 ms
24,672 KB
testcase_15 AC 34 ms
24,672 KB
testcase_16 AC 33 ms
24,672 KB
testcase_17 AC 33 ms
24,672 KB
testcase_18 AC 33 ms
24,672 KB
testcase_19 AC 33 ms
24,672 KB
testcase_20 AC 35 ms
24,672 KB
testcase_21 AC 32 ms
24,672 KB
testcase_22 AC 33 ms
24,672 KB
testcase_23 AC 33 ms
24,672 KB
testcase_24 AC 33 ms
24,672 KB
testcase_25 AC 33 ms
24,672 KB
testcase_26 AC 35 ms
24,672 KB
testcase_27 AC 36 ms
24,672 KB
testcase_28 AC 34 ms
24,672 KB
testcase_29 AC 34 ms
24,672 KB
testcase_30 AC 34 ms
24,672 KB
testcase_31 AC 33 ms
24,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0