Count Server that Communicate(C++統計通信に参加するサーバ)


(1)行数、列数
(2)mapによる重複除外
class Solution {
private:
    int count=0;
public:
    int countServers(vector>& grid) {
        int m=grid.size(),n=grid[0].size();
        unordered_map mp;
        int first=0,second=0;
        // 
        for(int i=0;i1) mp[to_string(first)+'_'+to_string(second)]=1;
            count=0;
        }

        // 
        for(int i=0;i1) mp[to_string(first)+'_'+to_string(second)]=1;
            count=0;
        }


        return mp.size();
    }
};