From 09f7579e8194a0965eda4e33ed707676f3802c67 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Wed, 8 Jul 2026 18:05:04 +0900 Subject: [PATCH] =?UTF-8?q?1931=20:=20=ED=9A=8C=EC=9D=98=EC=8B=A4=20?= =?UTF-8?q?=EB=B0=B0=EC=A0=95=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week5/BOJ1931/BOJ1931_V1.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/week5/BOJ1931/BOJ1931_V1.cpp diff --git a/src/week5/BOJ1931/BOJ1931_V1.cpp b/src/week5/BOJ1931/BOJ1931_V1.cpp new file mode 100644 index 0000000..5469c4e --- /dev/null +++ b/src/week5/BOJ1931/BOJ1931_V1.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +int main() { + + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + int n; + cin >> n; + vector> inp; + + for (int i=0; i> st >> ed; + inp.push_back({ed,st}); + } + + sort(inp.begin(), inp.end()); + + int t=0, ret=0; + for (pair next : inp) { + if (next.second >= t) { + ret++; + t = next.first; + } + } + + cout << ret; + + return 0; +} \ No newline at end of file