結果
問題 |
No.1557 Binary Variable
|
ユーザー |
|
提出日時 | 2021-07-09 20:05:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 596 ms |
コンパイル使用メモリ | 70,072 KB |
実行使用メモリ | 7,220 KB |
最終ジャッジ日時 | 2024-07-01 14:06:17 |
合計ジャッジ時間 | 11,797 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 11 RE * 18 |
ソースコード
#include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 1e6+10,mod=998244353; typedef long long LL; struct Node{ int 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); int ed=-2e9-10,res=0; for(int i=1;i<=n;i++){ if(node[i].l>ed){ res++; ed=node[i].r; } } cout<<n-res; return 0; }