프로그래머스 - 좌석 구매 : 스쿨에 있는 문제

phoenixKim·2021년 10월 5일
0

풀이 전략

  • map의 key값을 pair값으로 사용하기

소스코드

#include <vector>
#include <iostream>
#include <map>
using namespace std;

int solution(vector<vector<int> > seat)
{
    int answer = -1;
    
    map<pair<int,int>, bool>m;

    for(auto iter : seat)
    {
        m.insert({{iter[0], iter[1]}, true});
    }
    
    answer = m.size();
    return answer;
}
profile
🔥🔥🔥

0개의 댓글

관련 채용 정보