L1-087 机工士姆斯塔迪奥 分数 20

无论技能释放在哪一行,并不影响剩余格子数量,只需统计出现了多少不同的行和列

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, q;
    cin >> n >> m >> q;
    map<int,bool> hash1, hash2;
    int cnt1 = 0, cnt2 = 0;
    for(int i = 1; i <= q; ++ i)
    {
        int t, c;
        cin >> t >> c;
        if(t == 0)
        	if(hash1[c] == false)
                hash1[c] = true, -- n;
        if(t == 1)
        	if(hash2[c] == false)
                hash2[c] = true, -- m;
    }
    cout << n * m;
    return 0;
}
posted @ 2024-08-20 21:31  Frodnx  阅读(33)  评论(0)    收藏  举报