結果

問題 No.1959 Prefix MinMax
ユーザー kyawa
提出日時 2022-05-27 22:01:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 1,919 ms
コンパイル使用メモリ 195,920 KB
最終ジャッジ日時 2025-01-29 16:01:26
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int64_t T; cin >> T;
    while(T--){
        int64_t N; cin >> N;
        vector<int64_t> A(N), B(N);
        cout << '?';
        for(int64_t i = 0; i < N-1; i++) cout << " " << (i & 1);
        cout << endl;
        for(auto &a : A) cin >> a;
        cout << '?';
        for(int64_t i = 0; i < N-1; i++) cout << " " << ((i & 1) ^ 1);
        cout << endl;
        for(auto &b : B) cin >> b;
        cout << '!' << " " << A[0];
        for(int64_t i = 1; i < N; i++){
            if(A[i-1] != A[i]){
                cout << " " << A[i];
                continue;
            }
            if(B[i-1] != B[i]){
                cout << " " << B[i];
                continue;
            }
            cout << " " << A[i];
        }
        cout << endl;
    }
}
0