結果

問題 No.2559 眩しい数直線
ユーザー Nichi10pNichi10p
提出日時 2023-12-02 14:39:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 2,141 ms
コンパイル使用メモリ 202,680 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 14:39:32
合計ジャッジ時間 2,977 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 3 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 4 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 3 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 3 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 3 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

template<class T> bool chmax(T &a, const T &x) { return x > a ? a = x, true : false; }

int main() {
  int N, X;
  std::cin >> N >> X;

  std::vector<int> L(X+1);
  while (N--) {
    int A, B;
    std::cin >> A >> B;
    for (int x = 1; x <= X; ++x)
      chmax(L[x], std::max(B - std::abs(x - A), 0));
  }

  for (size_t i = 1; i < L.size(); ++i)
    std::cout << L[i] << " \n"[i+1 == L.size()];
}
0