#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES //libs #include #include #include #include #include #include #include #include #include #include #include using namespace std; //defines #define infll 8e18 #define ll long long #define itn ll #define vi vector #define vvi vector #define pii pair //constants const double eps = 1e-7; const ll mod = 1000000007; //end of definition int cnt=0; int N=2e5; vi mi(N),ma(N); void pr() { mi[0]=0;ma[0]=0; mi[1]=0,ma[1]=0; for (int i=2;ir) return; if (l==r) { ans.push_back(l); return; } ans.push_back((l+r)/2); csmin(l,(l+r)/2-1); csmin((l+r)/2+1,r); } vi lena_sort(vi nums) { if (nums.size() <= 1) { return nums; } int pivot = nums[0]; vi less; vi more; for (int i = 1; i < nums.size(); ++i) { // Comparison cnt++; if (nums[i] < pivot) { less.push_back(nums[i]); } else { more.push_back(nums[i]); } } vi sorted_less = lena_sort(less); vi sorted_more = lena_sort(more); sorted_less.push_back(pivot); for (int i=0;i=mi[n-i-1]&&q<=ma[n-i-1]) { ans.push_back(i+1); for (int j=0;j=mi[n-i-1]&&q<=ma[n-i-1]) { ans.push_back(i+1); csmin(1,i); if (b+i+1> n >> c; if (c>ma[n] || c> n; for (int i=0;i