#include #include #include #include #define INF 1e8 struct pair { int A, B; }; int main() { int N, X; std::cin >> N >> X; std::vector array(N); for (auto &&e: array) { std::cin >> e.A >> e.B; } // さて、計算 std::vector result(X); // 座標の数だけ計算 for (int j = 0; j < X; j++) { int max = -INF; // 街灯の数だけ計算 for (int i = 0; i < N; i++) { // 街灯 i の眩しさを計算 int brightness = std::max( array[i].B - std::abs(j + 1 - array[i].A), 0 ); // 一番眩しいものを取得する if (max < brightness) { max = brightness; } } // 結果を格納する result.at(j) = max; } for (auto &&e: result) { std::cout << e << " "; } std::cout << std::endl; }