#include using namespace std; int n,m; struct animal { int type; int s; int d; }animals[500005]; maptypeMap; int times[500005]; vector< pair >dislike; map< pair >,int>dp; bool cmp(animal x , animal y) { return x.dendTime) return 0; if(dp.find(make_pair(mask,make_pair(i,endTime)))!=dp.end()) { return dp[make_pair(mask,make_pair(i,endTime))]; } int l=0,r=0; int bit1=dislike[animals[i].type].first; int bit2=dislike[animals[i].type].second; if( ( !(correctMask & (1<ans; int required=1; for(int i=1;i<=m;i++) { while(times[i]>=required) { ans.push_back(i); required++; } // printf("%d ",times[i] ); } //printf("\n\n"); int i=0; for(;i