// 愚直解チェック #include #include #include #include using namespace std; using ll = long long; #define CIN( LL , A ) LL A; cin >> A #define FOR_LL( VAR , INITIAL , FINAL_PLUS_ONE ) for( ll VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define RETURN( ANSWER ) cout << ( ANSWER ) << endl; return 0 int main() { CIN( ll , N ); if( N < 3 ){ RETURN( "NO" ); } CIN( ll , A0 ); CIN( ll , A1 ); CIN( ll , A2 ); CIN( ll , A3 ); CIN( ll , A4 ); CIN( ll , A5 ); ll M[6] = { 0 , 1 , 2 , 4 , 16 , 65536 }; ll MN[3]; ll& MN0 = MN[A2]; ll& MN1 = MN[A0]; ll& MN2 = MN[A5]; MN0 = M[N]; // MN1 = M[N - 1]; MN1 = M[N]; // MN2 = M[N - 2]; MN2 = M[N]; ll v[3]; constexpr const ll digit = 64; FOR_LL( v0 , 0 , MN0 ){ FOR_LL( v1 , 0 , MN1 ){ FOR_LL( v2 , 0 , MN2 ){ ll& vA2 = v[A2]; ll& vA0 = v[A0]; ll& vA5 = v[A5]; vA2 = v0; vA0 = v1; vA5 = v2; ll& vA1 = v[A1]; ll vA0_copy = vA0; ll vA1_copy = vA1; bool b = true; FOR_LL( i , 0 , MN2 ){ if( vA0_copy % 2 > vA1_copy % 2 ){ i = MN2; b = false; } else { vA0_copy /= 2; vA1_copy /= 2; } } if( b ){ ll& vA3 = v[A3]; ll& vA4 = v[A4]; if( vA1 < MN1 && vA3 < MN1 && vA4 < MN1 ){ if( ( vA1 < digit && ( vA2 >> vA1 ) % 2 == 1 ) && ( vA3 < digit && ( vA2 >> vA3 ) % 2 == 1 ) && ( vA4 < digit && ( vA2 >> vA4 ) % 2 == 1 ) && ( vA5 < digit && ( vA0 >> vA5 ) % 2 == 1 ) ){ RETURN( "YES" ); } } } } } } RETURN( "NO" ); }