結果
| 問題 |
No.1557 Binary Variable
|
| コンテスト | |
| ユーザー |
noya2
|
| 提出日時 | 2021-04-18 13:51:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 186 ms / 2,000 ms |
| コード長 | 593 bytes |
| コンパイル時間 | 4,003 ms |
| コンパイル使用メモリ | 254,316 KB |
| 最終ジャッジ日時 | 2025-01-20 21:35:17 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using namespace atcoder;
using namespace internal;
using P = pair<int, int>;
template <typename SD>
void sor(vector<SD> &ar){sort(ar.begin(),ar.end());}
int main(){
int n, m; cin >> n >> m;
int ans = n;
vector<P> ar(m);
rep(i,m){
int l, r; cin >> l >> r;
ar[i] = P(r,l-1);
}
sor(ar);
int t = 0;
rep(i,m){
if (t <= ar[i].second){
ans--;
t = ar[i].first;
}
}
cout << ans << endl;
}
noya2