[백준/2170] 선 긋기 (C++/골드5)
·
Problem Solving/Baekjoon
https://www.acmicpc.net/problem/2170선 긋기 문제입니다.그리디를 활용하여 풀었습니다.#include #include #include using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int N; cin >> N; vector> v; for (int i=0; i> start >> end; v.push_back({start, end}); } sort(v.begin(), v.end(), [](const pair&a, const pair&b) { return a.first beforeEnd)..