Sherlock and Queries

  • + 0 comments

    One more hint. If B[i]==1, you need to multiply every A on all C's product. It can be done in O(N+M).