結果

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

ソースコード

diff #

#include <bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
const ll mod = 1000000007;
//const ll mod = 998244353;
int n, x, a[1009], b[1009],ans[1009];
int main() {
	cin >> n >> x;
	for (int i = 1; i <= n; i++)cin >> a[i] >> b[i];
	for (int i = 1; i <= x; i++) {
		ans[i] = 0;
		for (int j = 1; j <= n; j++) {
			ans[i] = max(ans[i], b[j] - abs(i - a[j]));
		}
		cout << ans[i] <<" ";
	}
	cout << endl;
}
0