結果
| 問題 |
No.1557 Binary Variable
|
| コンテスト | |
| ユーザー |
ocvret_
|
| 提出日時 | 2021-06-26 18:20:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 2,000 ms |
| コード長 | 695 bytes |
| コンパイル時間 | 1,721 ms |
| コンパイル使用メモリ | 173,308 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-25 09:14:40 |
| 合計ジャッジ時間 | 7,782 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>
using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
int main(){
int n,m;
cin >> n >> m;
vector<P> v(m);
rep(i,m)cin >> v[i].first >> v[i].second;
sort(ALL(v));
int pre = 0;
int res = 0;
rep(i,m){
if(v[i].first <= pre)pre = min(pre,v[i].second);
else{
res++;
pre = v[i].second;
}
}
cout << n-res << "\n";
return 0;
}
ocvret_