結果
問題 | No.1557 Binary Variable |
ユーザー |
|
提出日時 | 2021-07-09 20:08:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 513 bytes |
コンパイル時間 | 633 ms |
コンパイル使用メモリ | 69,632 KB |
実行使用メモリ | 6,912 KB |
最終ジャッジ日時 | 2024-07-01 14:06:24 |
合計ジャッジ時間 | 6,959 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int N = 1e6+10,mod=998244353;typedef long long LL;struct Node{LL l,r;bool operator<(const Node &a)const{return r<a.r;}}node[N];int main(){LL n,m;scanf("%lld%lld",&n,&m);for(int i=1;i<=m;i++){cin>>node[i].l>>node[i].r;}sort(node+1,node+1+m);LL ed=-2e9-10,res=0;for(int i=1;i<=m;i++){if(node[i].l>ed){res++;ed=node[i].r;}}cout<<n-res;return 0;}