#include #define in cin>> #define out cout<< #define mau ios::sync_with_stdio(0); #define tidur cin.tie(0); #define ll long long using namespace std; ll best, totgain; ll binser(ll tree[], ll left, ll right, ll pos){ while (left <= right) { int m = left + (right - left) / 2; if (tree[m] == pos) return 1; if (tree[m] < pos) left = m + 1; else right = m - 1; } return 0; } ll count(ll n, ll m, ll pos[], ll dark[], ll light[], ll tree[], ll c){ ll s=0; for(ll i=0; itotgain){ return 0; } best=max(best, count(n, m, pos, dark, light, tree, c)); ll newposr[m+5]; for(ll i=0; i> m; ll tree[n]={0}, pos[m]={0}, dark[m]={0}, light[m]={0}; for(ll i=0; i> dark[i] >> light[i]; totgain+=light[i]-dark[i]; } solve(n, m, pos, dark, light, tree, 0); out best; }