結果
問題 | No.2559 眩しい数直線 |
ユーザー |
![]() |
提出日時 | 2023-12-02 15:07:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 621 bytes |
コンパイル時間 | 3,683 ms |
コンパイル使用メモリ | 229,528 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 18:07:49 |
合計ジャッジ時間 | 4,509 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;using ll = long long;int main(){int n, x;cin >> n >> x;vector<int> a (n), b (n);vector<int> l (x + 1, 0);for(int i = 0; i < n; ++i){cin >> a[i] >> b[i];}for(int i = 0; i < n; ++i){for(int j = 0; j <= b[i]; ++j){if(a[i] - j <= x && a[i] - j >= 1) l[a[i] - j] = max(l[a[i] - j], b[i] - j);}for(int j = 0; j <= b[i]; ++j){if(a[i] + j <= x && a[i] + j >= 1) l[a[i] + j] = max(l[a[i] + j], b[i] - j);}}for(int i = 0; i < x; ++i){cout << l[i + 1] << " ";}cout << endl;}