You know that an array has $n$ integers between 1 and $m$, and the absolute difference between two adjacent values is at most 1. Given a description of the array ...
#define rep(i,a,b) for (int i=a; i<b; ++i) #define rev(i,a,b) for (int i=a; i>b; --i) #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ...