Notice
Recent Posts
Recent Comments
Link
스토리지
(임시) 백준 1931 회의실배정 본문
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i].second >> a[i].first;
}
sort(a.begin(), a.end());
int savetime = 0, ans = 0;
for (int i = 0; i < n; i++) {
if (savetime <= a[i].second) {
savetime = a[i].first;
ans++;
}
}
printf("%d", ans);
}
일단 C# 자료구조를 잘 몰라 C++로...
추후 C#으로 다시
'알고리즘' 카테고리의 다른 글
프로그래머스 84325 - 직업군 추천하기 (0) | 2021.08.25 |
---|---|
프로그래머스 81301 - 숫자 문자열과 영단어 (0) | 2021.08.25 |
[08.22] 백준 1541 - 잃어버린 괄호 (0) | 2021.08.22 |
[07.15] 백준 11047 - 동전 0 (파이썬) (1) | 2021.07.15 |
[07.15] 백준 11720 - 숫자의 합 (파이썬) (0) | 2021.07.15 |
Comments