結果

問題 No.2559 眩しい数直線
ユーザー eve__fuyuki
提出日時 2023-12-03 22:55:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 2,063 ms
コンパイル使用メモリ 193,416 KB
最終ジャッジ日時 2025-02-18 06:55:06
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
int main() {
    fast_io();
    int n, x;
    cin >> n >> x;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int j = 1; j <= x; j++) {
        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans = max(ans, b[i] - abs(a[i] - j));
        }
        cout << ans << (j == x ? '\n' : ' ');
    }
}
0