#pragma GCC optimize ("O3") #pragma GCC target ("tune=native") #pragma GCC target ("avx") //#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair P; typedef pair PPI; typedef pair PIP; typedef vector vl; typedef vector vvl; typedef vector

vp; #define PQ(T) priority_queue,greater> #define PQ2(T) priority_queue const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i)) #define rep(i,n) REP(i,0,n) #define rep1(i,n) REP(i,1,n+1) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) ((x)=min((x),(y))) #define chmax(x,y) ((x)=max((x),(y))) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) #define DEBUG(x) cerr<<"line ("<<__LINE__<<") "<<#x<<": "< ostream &operator<<(ostream &os, const vector &v){int n=v.size();rep(i,n)os< q; rep(i, m){ ll x, y; cin>>x>>y; d[x][y] = 0; q.push(P(x, y)); } while(!q.empty()){ P p = q.front(); q.pop(); int x = p.fst, y = p.snd; rep(i, 6){ int x2 = x+dx[i], y2= y+dy[i]; if(x2<1||y2<1||x2>n||y2>x2||d[x2][y2]1){ ll md = (lb+ub+1)/2; (f(i, j, md)>=S?ub:lb)=md; } res += n-i+2-ub; } printf("%lld\n", res); return 0; }