結果

問題 No.1995 CHIKA Road
ユーザー MasKoaTSMasKoaTS
提出日時 2022-02-19 16:39:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 750 ms
コンパイル使用メモリ 83,428 KB
実行使用メモリ 8,728 KB
最終ジャッジ日時 2023-09-17 05:09:07
合計ジャッジ時間 3,384 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 19 ms
4,572 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 47 ms
8,648 KB
testcase_11 AC 84 ms
8,532 KB
testcase_12 AC 79 ms
8,528 KB
testcase_13 AC 28 ms
4,836 KB
testcase_14 AC 31 ms
4,836 KB
testcase_15 AC 77 ms
7,724 KB
testcase_16 AC 10 ms
4,376 KB
testcase_17 AC 39 ms
6,152 KB
testcase_18 AC 66 ms
8,728 KB
testcase_19 AC 66 ms
8,580 KB
testcase_20 AC 34 ms
5,872 KB
testcase_21 AC 31 ms
5,820 KB
testcase_22 AC 59 ms
8,564 KB
testcase_23 AC 19 ms
4,568 KB
testcase_24 AC 52 ms
7,508 KB
testcase_25 AC 12 ms
4,376 KB
testcase_26 AC 21 ms
4,904 KB
testcase_27 AC 51 ms
7,452 KB
testcase_28 AC 32 ms
5,732 KB
testcase_29 AC 62 ms
8,248 KB
testcase_30 AC 11 ms
4,380 KB
testcase_31 AC 6 ms
4,380 KB
testcase_32 AC 14 ms
4,380 KB
testcase_33 AC 51 ms
7,208 KB
testcase_34 AC 6 ms
4,376 KB
testcase_35 AC 20 ms
4,884 KB
testcase_36 AC 26 ms
5,148 KB
testcase_37 AC 60 ms
8,000 KB
testcase_38 AC 43 ms
6,532 KB
testcase_39 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0