結果

問題 No.1557 Binary Variable
ユーザー ぷら
提出日時 2021-12-11 15:23:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 200,040 KB
最終ジャッジ日時 2025-01-26 07:51:21
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N,M;
    cin >> N >> M;
    vector<pair<int,int>>tmp(M);
    for(int i = 0; i < M; i++) {
        cin >> tmp[i].second >> tmp[i].first;
    }
    sort(tmp.begin(),tmp.end());
    int mx = 0,sum = 0;
    for(int i = 0; i < M; i++) {
        if(mx >= tmp[i].second) {
            continue;
        }
        mx = tmp[i].first;
        sum++;
    }
    cout << N-sum << endl;
}
0