結果
| 問題 |
No.1995 CHIKA Road
|
| コンテスト | |
| ユーザー |
MasKoaTS
|
| 提出日時 | 2022-02-19 16:39:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 116 ms / 2,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 912 ms |
| コンパイル使用メモリ | 82,060 KB |
| 最終ジャッジ日時 | 2025-01-28 01:00:36 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, l, n) for (int i = (l); i < (n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T> >;
int main(void) {
int n, m; cin >> n >> m;
VV<int> plan(m);
rep(i, 0, m) {
int a, b; cin >> a >> b;
plan[i] = { a,b };
}
sort(all(plan), [](auto& l, auto& r) {
return (l[1] < r[1]);
});
int now = 0;
int ans = 2 * (n - 1);
for (auto& x : plan) {
if (now > x[0]) {
continue;
}
now = x[1];
ans--;
}
cout << ans << endl;
return 0;
}
MasKoaTS