結果
問題 | No.1557 Binary Variable |
ユーザー |
![]() |
提出日時 | 2021-06-25 21:28:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 199 ms / 2,000 ms |
コード長 | 511 bytes |
コンパイル時間 | 2,221 ms |
コンパイル使用メモリ | 200,500 KB |
最終ジャッジ日時 | 2025-01-22 12:00:13 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int n, m;cin >> n >> m;vector<pair<int, int>> seg(m);for (int i = 0; i < m; i++){cin >> seg.at(i).second >> seg.at(i).first;}sort(seg.begin(), seg.end());int current = -1, ans = n;for (int i = 0; i < m; i++){auto [r, l] = seg.at(i);if (l <= current){continue;}current = r;ans--;}cout << ans << endl;return 0;}