結果

問題 No.1959 Prefix MinMax
ユーザー beetbeet
提出日時 2022-05-27 22:30:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 940 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 205,008 KB
実行使用メモリ 24,684 KB
平均クエリ数 26.41
最終ジャッジ日時 2023-10-20 21:22:55
合計ジャッジ時間 5,295 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}

//INSERT ABOVE HERE
void solve(){
  Int n;
  cin>>n;

  vector<Int> ps(n,-1);

  Int cnt=0;
  while(true){
    cout<<"?";
    for(Int i=1;i<n;i++) cout<<' '<<((i+cnt)&1);
    cout<<endl;
    cnt++;

    auto bs=read(n);

    ps[0]=bs[0];
    for(Int i=1;i<n;i++)
      if(bs[i-1]!=bs[i]) ps[i]=bs[i];

    if(*min_element(ps.begin(),ps.end())>0) break;
  }
  cout<<"!";
  for(Int i=0;i<n;i++) cout<<' '<<ps[i];
  cout<<endl;
}

signed main(){
  Int T;
  cin>>T;
  while(T--) solve();
  return 0;
}
0