結果

問題 No.1557 Binary Variable
ユーザー the-xinthe-xin
提出日時 2021-07-09 20:05:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 515 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 69,516 KB
実行使用メモリ 5,304 KB
最終ジャッジ日時 2023-09-14 06:37:49
合計ジャッジ時間 11,263 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 132 ms
5,044 KB
testcase_15 WA -
testcase_16 AC 131 ms
4,948 KB
testcase_17 AC 129 ms
5,296 KB
testcase_18 AC 127 ms
5,172 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0