結果
問題 |
No.1995 CHIKA Road
|
ユーザー |
![]() |
提出日時 | 2022-07-01 23:21:09 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 2,598 ms |
コンパイル使用メモリ | 254,556 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-26 07:18:35 |
合計ジャッジ時間 | 4,995 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int N,M; cin>>N>>M; vector<pair<int,int>> S(M); for(int i=0;i<M;i++){ int a,b; cin>>a>>b; S[i] = {b,a}; } sort(S.begin(),S.end()); int now = S[0].first; int ans = 0; for(int i=1;i<M;i++){ int b,a; tie(b,a) = S[i]; if(now <= a){ ans++; now = b; } } cout<<(N-1)*2-ans-1<<endl; }