/* -*- coding: utf-8 -*- * * 2662.cc: No.2662 Installing Cell Towers - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ typedef long long ll; /* global variables */ int es[MAX_N]; /* subroutines */ /* main */ int main() { int n, m; scanf("%d%d", &n, &m); ll s = 0; for (int i = 0; i < m; i++) { int pi, qi; scanf("%d%d", &pi, &qi); pi--; int p0 = pi - qi, p1 = pi + qi; s += max(0, -p0); es[max(0, p0)]++; es[pi] -= 2; if (p1 < n) es[p1]++; } ll d = 0; for (int i = 0; i < n; i++) { s += d; printf("%lld%c", s, (i + 1 < n) ? ' ' : '\n'); d += es[i]; } return 0; }