結果

問題 No.2559 眩しい数直線
ユーザー Hayato2475
提出日時 2023-12-02 15:03:49
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 5,472 ms
コンパイル使用メモリ 306,768 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-26 17:58:27
合計ジャッジ時間 5,900 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define rep(i,a,n) for (int i = a; i < (n); i++)
template<typename T> inline bool chmax(T& a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T& a, T b) { return ((a > b) ? (a = b, true) : (false)); }

int main() {
    int n,x;
    cin >> n >> x;
    vector<int> a(1010),b(1010),l(1010);
    rep(i,0,n){
        cin >> a[i] >> b[i];
        rep(j,1,x+1){
            int tmp = max(b[i] - abs(j-a[i]),0);
            chmax(l[j-1], tmp);
        }
    }
    rep(i,0,x){
        cout << l[i] << " ";
    }
}
0