結果
| 問題 |
No.1557 Binary Variable
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2023-06-12 00:14:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 209 ms / 2,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 1,338 ms |
| コンパイル使用メモリ | 112,292 KB |
| 最終ジャッジ日時 | 2025-02-14 01:55:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
using namespace std;
using ll = long long;
int main(){
int N, M, l, r, now=-1;
cin >> N >> M;
vector<pair<int, int>> RL(M);
for (int i=0; i<M; i++){
cin >> l >> r;
RL[i] = {r, l};
}
sort(RL.begin(), RL.end());
for (int i=0; i<M; i++){
tie(r, l) = RL[i];
if (now < l){
now = r;
N--;
}
}
cout << N << endl;
return 0;
}
srjywrdnprkt