結果

問題 No.909 たぴの配置
ユーザー 東前頭十一枚目東前頭十一枚目
提出日時 2019-10-18 22:02:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 130 ms / 3,000 ms
コード長 540 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 165,512 KB
実行使用メモリ 6,684 KB
最終ジャッジ日時 2023-09-07 23:31:15
合計ジャッジ時間 5,503 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 125 ms
6,616 KB
testcase_06 AC 129 ms
6,684 KB
testcase_07 AC 118 ms
6,244 KB
testcase_08 AC 126 ms
6,372 KB
testcase_09 AC 130 ms
6,492 KB
testcase_10 AC 120 ms
6,304 KB
testcase_11 AC 119 ms
6,140 KB
testcase_12 AC 121 ms
6,384 KB
testcase_13 AC 125 ms
6,440 KB
testcase_14 AC 120 ms
6,164 KB
testcase_15 AC 119 ms
6,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int64_t n; cin >> n;
	int64_t x[n];
	for(int i = 0; i < n; ++i) cin >> x[i];
	int64_t y[n];
	for(int i = 0; i < n; ++i) cin >> y[i];
	const int64_t INF = 1e18;
	int64_t dmax = INF;
	for(int i = 0; i < n; ++i) {
		dmax = min(dmax, x[i] + y[i]);
	}
	cout << dmax << '\n';
	cout << 0 << '\n';
	for(int i = 0; i < n; ++i) {
		if(x[i] < y[i]) {
			cout << min(x[i], dmax) << '\n';
		} else {
			cout << max<int64_t>(0, dmax - y[i]) << '\n';
		}
	}
	cout << dmax << '\n';
	return 0;
}
0