#include using namespace std; using ll=long long; using pll=pair; using tll=tuple; using ld=long double; const ll INF=(1ll<<60); #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define all(v) v.begin(),v.end() template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> n; vector a(n); rep(i,n) cin >> a[i]; vector>> dp(n,vector>(2,vector(2,0))); if(a[0]==0){ dp[1][1][1]=true; } if(a[0]==1){ dp[1][1][0]=true; dp[1][0][1]=true; } if(a[0]==2){ dp[1][0][0]=true; } for(ll i=1;i> t; while(t--){ solve(); } }