#include #include using namespace std; int main() { long long W, H, Ans = 0; long long Use = 0,True_num = 0; int N; cin >> W >> H >> N; vector S(N), K(N); vector use_mark(W,0); vector use_num(H, false); for (int i = 0; i < N;i++) { cin >> S[i] >> K[i]; if (use_mark[S[i] - 1] == 0) { Use++; } use_mark[S[i] - 1]++; if (use_num[K[i] - 1] == false) { use_num[K[i] - 1] = true; True_num++; } } for (int i = 0; i < W;i++) { if (use_mark[i] != 0) { Ans += (H - use_mark[i]); } } Ans += (W - Use) * True_num; cout << Ans << endl; return 0; }