結果
問題 | No.1557 Binary Variable |
ユーザー |
|
提出日時 | 2021-06-25 21:25:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 177 ms / 2,000 ms |
コード長 | 396 bytes |
コンパイル時間 | 778 ms |
コンパイル使用メモリ | 76,412 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 08:06:52 |
合計ジャッジ時間 | 6,956 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream>#include<algorithm>#include<vector>using namespace std;int N,M;main(){cin>>N>>M;vector<pair<int,int> >A(M);for(int i=0;i<M;i++)cin>>A[i].first>>A[i].second;sort(A.begin(),A.end(),[](pair<int,int>l,pair<int,int>r){return l.second<r.second;});int cnt=0,pre=0;for(pair<int,int>p:A){if(pre<p.first){cnt++;pre=p.second;}}cout<<N-cnt<<endl;}