結果

問題 No.1557 Binary Variable
ユーザー magstamagsta
提出日時 2021-05-15 19:18:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 170,876 KB
実行使用メモリ 6,348 KB
最終ジャッジ日時 2023-09-07 13:55:48
合計ジャッジ時間 9,141 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
6,296 KB
testcase_01 AC 136 ms
6,212 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 90 ms
6,288 KB
testcase_05 AC 90 ms
6,164 KB
testcase_06 AC 85 ms
6,220 KB
testcase_07 AC 87 ms
6,100 KB
testcase_08 AC 99 ms
6,220 KB
testcase_09 AC 99 ms
6,264 KB
testcase_10 AC 108 ms
6,284 KB
testcase_11 AC 109 ms
6,160 KB
testcase_12 AC 98 ms
6,292 KB
testcase_13 AC 111 ms
6,216 KB
testcase_14 AC 123 ms
6,176 KB
testcase_15 AC 110 ms
6,156 KB
testcase_16 AC 121 ms
6,108 KB
testcase_17 AC 119 ms
6,112 KB
testcase_18 AC 117 ms
6,160 KB
testcase_19 AC 132 ms
6,264 KB
testcase_20 AC 130 ms
6,108 KB
testcase_21 AC 133 ms
6,208 KB
testcase_22 AC 134 ms
6,224 KB
testcase_23 AC 133 ms
6,228 KB
testcase_24 AC 137 ms
6,280 KB
testcase_25 AC 135 ms
6,148 KB
testcase_26 AC 141 ms
6,284 KB
testcase_27 AC 142 ms
6,268 KB
testcase_28 AC 144 ms
6,108 KB
testcase_29 AC 154 ms
6,336 KB
testcase_30 AC 149 ms
6,096 KB
testcase_31 AC 153 ms
6,112 KB
testcase_32 AC 151 ms
6,348 KB
testcase_33 AC 130 ms
6,176 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	long long N, M; cin >> N >> M;
	vector <pair<long long, long long>> LR(M);
	for (int i = 0; i < M; i++) cin >> LR[i].first >> LR[i].second;
	sort(LR.begin(), LR.end());
	long long min_ = 1LL << 60;
	long long count = 0;

	for (int i = 0; i < M; i++) {
		if (LR[i].first <= min_) {
			min_ = min(min_, LR[i].second);
		}
		else {
			min_ = 1LL << 60;
			count++;
			i--;
		}
	}

	if (min_ != 1LL << 60) count++;
	cout << N - count << endl;
}
0