結果
問題 | No.1557 Binary Variable |
ユーザー |
![]() |
提出日時 | 2021-06-25 21:48:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 180 ms / 2,000 ms |
コード長 | 636 bytes |
コンパイル時間 | 1,762 ms |
コンパイル使用メモリ | 176,796 KB |
実行使用メモリ | 9,600 KB |
最終ジャッジ日時 | 2024-06-25 08:23:22 |
合計ジャッジ時間 | 8,156 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long longusing vec_int = vector<int>;using P = pair<int,int>;using T = tuple<int,int,int>;using ll = long long;#define rep(i, n) for(int i = 0; i < (int)(n); i++)signed main(){int N, M; cin>>N>>M;vec_int L(M), R(M);rep(i,M)cin>>L.at(i)>>R.at(i);vector<P> RL(M);rep(i,M)RL.at(i) = make_pair(R.at(i), L.at(i));sort(RL.begin(), RL.end());int zeros = 0;int right = 0;rep(i,M){if(RL.at(i).second>right){right = RL.at(i).first;zeros++;}}cout<<N-zeros<<endl;return 0;}