結果
問題 |
No.2559 眩しい数直線
|
ユーザー |
![]() |
提出日時 | 2023-12-03 23:56:16 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 3,382 ms |
コンパイル使用メモリ | 245,372 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 22:24:28 |
合計ジャッジ時間 | 3,541 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,a) for(int i = 0; i < (a); ++i) template<typename T> bool chmax(T &a,T b){if(a<b){a=b; return true;} return false;} template<typename T> bool chmin(T &a,T b){if(a>b){a=b; return true;} return false;} int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); 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 i=1;i<=x;++i){ int res=0; for(int j=0;j<n;++j){ res = max(res,max(0,b[j]-abs(i-a[j]))); } cout << res << " "; } cout << endl; }