結果

問題 No.1995 CHIKA Road
ユーザー SSRSSSRS
提出日時 2022-07-01 21:26:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 171,812 KB
実行使用メモリ 4,888 KB
最終ジャッジ日時 2023-08-17 08:39:02
合計ジャッジ時間 5,991 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 19 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 51 ms
4,888 KB
testcase_11 AC 84 ms
4,624 KB
testcase_12 AC 88 ms
4,568 KB
testcase_13 AC 28 ms
4,376 KB
testcase_14 AC 31 ms
4,380 KB
testcase_15 AC 74 ms
4,596 KB
testcase_16 AC 10 ms
4,376 KB
testcase_17 AC 39 ms
4,376 KB
testcase_18 AC 64 ms
4,632 KB
testcase_19 AC 63 ms
4,560 KB
testcase_20 AC 34 ms
4,376 KB
testcase_21 AC 32 ms
4,376 KB
testcase_22 AC 60 ms
4,692 KB
testcase_23 AC 19 ms
4,380 KB
testcase_24 AC 53 ms
4,380 KB
testcase_25 AC 12 ms
4,376 KB
testcase_26 AC 22 ms
4,380 KB
testcase_27 AC 51 ms
4,376 KB
testcase_28 AC 31 ms
4,376 KB
testcase_29 AC 62 ms
4,580 KB
testcase_30 AC 11 ms
4,376 KB
testcase_31 AC 6 ms
4,376 KB
testcase_32 AC 14 ms
4,376 KB
testcase_33 AC 49 ms
4,376 KB
testcase_34 AC 7 ms
4,376 KB
testcase_35 AC 21 ms
4,376 KB
testcase_36 AC 24 ms
4,380 KB
testcase_37 AC 58 ms
4,428 KB
testcase_38 AC 40 ms
4,384 KB
testcase_39 AC 6 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for (int i = 0; i < M; i++){
    cin >> A[i] >> B[i];
  }
  vector<pair<int, int>> P(M);
  for (int i = 0; i < M; i++){
    P[i] = make_pair(B[i], A[i]);
  }
  sort(P.begin(), P.end());
  int q = 0;
  int c = 0;
  for (int i = 0; i < M; i++){
    if (q <= P[i].second){
      q = P[i].first;
      c++;
    }
  }
  cout << (N - 1) * 2 - c << endl;
}
0