You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
929 B
C++
33 lines
929 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 1e6 + 50;
|
|
pair<int, int> a[N];
|
|
int main()
|
|
{
|
|
int n, m, q;
|
|
scanf("%d%d%d", &n, &m, &q);
|
|
int cnt = 0;
|
|
for (int i = 1; i < n; i++)
|
|
for (int j = 1; j < m; j++)
|
|
a[cnt++] = {i, j};
|
|
set<pair<int, int>> S{a, a + cnt};
|
|
while (q--)
|
|
{
|
|
int x, y;
|
|
scanf("%d%d", &x, &y);
|
|
decltype(S)::iterator ite;
|
|
ite = S.find(make_pair(x, y));
|
|
if (ite != S.end()) S.erase(ite);
|
|
ite = S.find(make_pair(x - 1, y));
|
|
if (ite != S.end()) S.erase(ite);
|
|
ite = S.find(make_pair(x, y - 1));
|
|
if (ite != S.end()) S.erase(ite);
|
|
ite = S.find(make_pair(x - 1, y - 1));
|
|
if (ite != S.end()) S.erase(ite);
|
|
printf("%lld\n", S.size());
|
|
}
|
|
return 0;
|
|
}
|