Skip to content

Commit

Permalink
신입 사원
Browse files Browse the repository at this point in the history
  • Loading branch information
yewon-yw authored May 1, 2022
1 parent 8aa8e95 commit a694b8e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions greedy_algorithm/1946.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <iostream>
#include <vector>
#include <algorithm>
#pragma warning(disable:4996)
using namespace std;
vector < pair<int, int> > a;

int main() {
int T, N, count = 0;
int minv = 100001;
scanf("%d", &T);
for (int i = 0; i < T; i++) {
scanf("%d", &N);
for (int j = 0; j < N; j++) {
int tmp1, tmp2;
scanf("%d %d", &tmp1, &tmp2);
a.push_back(make_pair(tmp1, tmp2));
}
sort(a.begin(), a.end());
for (int j = 0; j < a.size(); j++) {
if (minv > a[j].second) {
count++;
minv = min(minv, a[j].second);
}
}
printf("%d\n", count);
a.clear();
minv = 100001;
count = 0;
}
}

0 comments on commit a694b8e

Please sign in to comment.