結果
問題 | No.2559 眩しい数直線 |
ユーザー |
|
提出日時 | 2023-12-02 14:43:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 646 bytes |
コンパイル時間 | 1,861 ms |
コンパイル使用メモリ | 195,448 KB |
最終ジャッジ日時 | 2025-02-18 03:51:17 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i,n) for (int i = 0; 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));}typedef long long ll;typedef pair<ll,ll> P;int main() {ll n, x;cin >> n >> x;vector<ll> a(n), b(n);rep(i,n) cin >> a[i] >> b[i];for(ll j = 1; j <= x; j++) {ll ans = 0;rep(i,n) {chmax(ans, max(b[i]-abs(j-a[i]), (ll)0));}cout << ans << " ";}cout << endl;return 0;}