#include #include #include #include #include #include #include using namespace std; using ll = long long; struct P { bool operator<(const P &p) const { return x < p.x; } int x, i; }; int main() { int h, w, q; cin >> h >> w >> q; ll r = (ll)h * w; vector

p(q); vector x(q), y(q); for (int i = 0; i < q; i++) { cin >> y[i] >> p[i].x; p[i].i = i; y[i]--; } sort(p.begin(), p.end()); int k = -1, t = -1; for (int i = 0; i < q; i++) { if (p[i].x != t) k++, t = p[i].x; x[p[i].i] = k; } k++; vector b(k, h); for (int i = 0; i < q; i++) { if (y[i] < b[x[i]]) { r -= b[x[i]] - y[i]; b[x[i]] = y[i]; } cout << r << '\n'; } return 0; }