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