VioletaBabel
11000번: 강의실 배정 본문
//엄청 느리게 짜였는데 통과는 해버림..
#include <cstdio>
#include <algorithm>
using namespace std;
typedef pair<int, int> pairInt;
int main()
{
int n, maxNum = 0;
scanf("%d", &n);
pairInt *s = new pairInt[n];
int *room = new int[n];
for (int i = 0; i < n; ++i)
{
scanf("%d %d", &s[i].first, &s[i].second);
room[i] = 0;
}
sort(s, s + n);
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
if (room[j] <= s[i].first)
{
room[j] = s[i].second;
if (maxNum < j)
maxNum = j;
break;
}
printf("%d", maxNum+1);
}
'백준 > 백준-C++' 카테고리의 다른 글
| 1057번: 토너먼트 (0) | 2017.05.25 |
|---|---|
| 11580번: Footprint (0) | 2017.05.25 |
| 2212번: 센서 (0) | 2017.05.24 |
| 1969번: DNA (0) | 2017.05.24 |
| 1931번: 회의실배정 (0) | 2017.05.24 |
Comments