結果
問題 | No.909 たぴの配置 |
ユーザー |
![]() |
提出日時 | 2019-10-18 22:02:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 140 ms / 3,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 1,505 ms |
コンパイル使用メモリ | 166,728 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 16:58:42 |
合計ジャッジ時間 | 5,133 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#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; }