結果
問題 | No.909 たぴの配置 |
ユーザー |
![]() |
提出日時 | 2019-10-19 00:39:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 377 ms / 3,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 1,691 ms |
コンパイル使用メモリ | 170,520 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-25 20:28:50 |
合計ジャッジ時間 | 7,545 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long long#define REP(i,n) for(int i = 0;i < (int)(n);i++)#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)#define FOR(i,s,n) for(int i = s;i < (int)n;i++)#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)#define ALL(a) a.begin(),a.end()template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}constexpr long long INF = 1e18;signed main(){int N;cin>>N;vector<int>tapi(N,INF);REP(i,N){int t;cin >> t;CHMIN(tapi[i],t);}int end = INF;vector<int>y(N);REP(i,N){cin>>y[i];CHMIN(end,tapi[i]+y[i]);}REP(i,N){CHMIN(tapi[i],max(0ll,end-y[i]));}cout<<end<<endl;int add = max(0ll,-*min_element(ALL(tapi)));cout<<add<<endl;for(auto &e:tapi)cout << e+add << endl;cout<<end+add<<endl;}