Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 우아한 테크 세미나
- Spring
- 10026번
- 에러핸들링
- C++
- FIFO paging
- OS
- 스프링 입문
- BOJ
- n타일링2
- Operating System
- Window-Via-c/c++
- 우아한레디스
- inflearn
- 열혈 TCP/IP 소켓 프로그래밍
- redis
- 김영한
- HTTP
- 이펙티브코틀린
- 2475번
- 운영체제
- 열혈 tcp/ip 프로그래밍
- 스프링 핵심 원리
- TCP/IP
- Four Squares
- 윤성우 저자
- Operating System.
- 토마토
- C#
- 제프리리처
Archives
- Today
- Total
나의 브을로오그으
[c++] 1931번 : 회의실 배정 본문
https://www.acmicpc.net/problem/1931
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<pair<int, int>> v;
int N = 0, from = 0, to = 0;
cin >> N;
v.reserve(N);
for (int i = 0; i < N; ++i)
{
cin >> from >> to;
v.push_back(make_pair(to, from));
}
sort(v.begin(), v.end());
int earliest = 0, count = 0, begin = 0, end = 0;
for (size_t i = 0; i < v.size(); ++i)
{
begin = v[i].second;
end = v[i].first;
if (earliest <= begin)
{
earliest = end;
++count;
}
}
cout << count << '\n';
return 0;
}
'알고리즘 > BaekJoon' 카테고리의 다른 글
[c++] 2178번 : 미로 탐색 (0) | 2022.06.23 |
---|---|
[c++] 1992번 : 쿼드트리 (0) | 2022.06.23 |
[c++] 1927번 : 최소 힙 (0) | 2022.06.21 |
[c++] 1764번 : 듣보잡 (0) | 2022.06.15 |
[c++] 1697번 : 숨바꼭질 (0) | 2022.06.14 |