// 誤解法(O(N + sum_q((r_q-l_q+1) + log_2 ((r'_q-l'_q+1)!)))愚直解)チェック #pragma GCC optimize ( "O3" ) #pragma GCC optimize( "unroll-loops" ) #pragma GCC target ( "sse4.2,fma,avx2,popcnt,lzcnt,bmi2" ) #include using namespace std; using ull = unsigned long long; #define MAIN main #define TYPE_OF( VAR ) remove_const::type >::type #define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr ) #define CEXPR( LL , BOUND , VALUE ) constexpr const LL BOUND = VALUE #define CIN( LL , A ) LL A; cin >> A #define ASSERT( A , MIN , MAX ) assert( ( MIN ) <= A && A <= ( MAX ) ) #define CIN_ASSERT( A , MIN , MAX ) CIN( TYPE_OF( MAX ) , A ); ASSERT( A , MIN , MAX ) #define FOR( VAR , INITIAL , FINAL_PLUS_ONE ) for( TYPE_OF( FINAL_PLUS_ONE ) VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define FOREQ( VAR , INITIAL , FINAL ) for( TYPE_OF( FINAL ) VAR = INITIAL ; VAR <= FINAL ; VAR ++ ) #define REPEAT( HOW_MANY_TIMES ) FOR( VARIABLE_FOR_REPEAT ## HOW_MANY_TIMES , 0 , HOW_MANY_TIMES ) #define QUIT return 0 #define COUT( ANSWER ) cout << ( ANSWER ) << "\n" inline CEXPR( int , c , 6 ); class Variable { public: ull m_val[c]; constexpr Variable() : m_val() { FOR( i , 0 , c ){ ull one{ 1 }; ull& m_val_i = m_val[i]; FOR( d , 0 , 64 ){ if( ( ( d >> i ) & 1 ) == 1 ){ m_val_i += one << d; } } } } }; int MAIN() { UNTIE; CEXPR( int , bound_N , 1000000 ); CIN_ASSERT( N , 1 , bound_N ); CEXPR( int , bound_Q , 100000 ); CIN_ASSERT( Q , 1 , bound_Q ); constexpr Variable P{}; static ull X[bound_N] = {}; FOR( i , 0 , N ){ X[i] = P.m_val[i % c]; } string land = "land"; string lor = "lor"; string Rightarrow = "Rightarrow"; string Yes = "Yes"; string No = "No"; N--; REPEAT( Q ){ CIN_ASSERT( h , 0 , N ); CIN( string , o ); CIN_ASSERT( l0 , 0 , N ); CIN_ASSERT( r0 , l0 , N ); CIN_ASSERT( l1 , 0 , N ); CIN_ASSERT( r1 , l1 , N ); ull Y = X[h]; if( o == land ){ FOREQ( i , l0 , r0 ){ X[i] &= Y; } } else if( o == lor ){ FOREQ( i , l0 , r0 ){ X[i] |= Y; } } else { assert( o == Rightarrow ); FOREQ( i , l0 , r0 ){ ( X[i] ^= -1 ) |= Y; } } set X_interval{}; bool found = false; FOREQ( i , l1 , r1 ){ ull& Xi = X[i]; if( X_interval.count( Xi ) == 0 ){ X_interval.insert( Xi ); } else { found = true; break; } } COUT( found ? Yes : No ); } QUIT; }