結果
問題 | No.2559 眩しい数直線 |
ユーザー |
![]() |
提出日時 | 2023-12-02 14:39:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 2,007 ms |
コンパイル使用メモリ | 192,524 KB |
最終ジャッジ日時 | 2025-02-18 03:45:00 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#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()]; }