結果

問題 No.3039 配信者
ユーザー tnakao0123
提出日時 2025-03-01 16:32:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 41,216 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-03-01 16:32:23
合計ジャッジ時間 4,507 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |   scanf("%d%d", &n, &h);
      |   ~~~~~^~~~~~~~~~~~~~~~
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |     scanf("%d%d", &ai, &bi);
      |     ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 3039.cc:  No.3039 驟堺ソ。閠・- yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_H = 1000000;

/* typedef */

/* global variables */

int cs[MAX_H + 1];

/* subroutines */

/* main */

int main() {
  int n, h;
  scanf("%d%d", &n, &h);

  for (int i = 0; i < n; i++) {
    int ai, bi;
    scanf("%d%d", &ai, &bi);
    cs[ai]++, cs[bi + 1]--;
  }

  for (int i = 0; i < h; i++) cs[i + 1] += cs[i];
  int maxd = *max_element(cs, cs + h);

  printf("%d\n", maxd);

  return 0;
}
0