結果

問題 No.909 たぴの配置
ユーザー chocopuuchocopuu
提出日時 2019-10-19 00:39:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 362 ms / 3,000 ms
コード長 906 bytes
コンパイル時間 1,554 ms
コンパイル使用メモリ 168,192 KB
実行使用メモリ 6,248 KB
最終ジャッジ日時 2023-09-08 03:19:18
合計ジャッジ時間 7,519 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 342 ms
5,852 KB
testcase_06 AC 356 ms
6,248 KB
testcase_07 AC 327 ms
5,908 KB
testcase_08 AC 345 ms
5,852 KB
testcase_09 AC 362 ms
6,208 KB
testcase_10 AC 333 ms
5,996 KB
testcase_11 AC 331 ms
6,148 KB
testcase_12 AC 335 ms
5,884 KB
testcase_13 AC 359 ms
6,148 KB
testcase_14 AC 335 ms
5,852 KB
testcase_15 AC 333 ms
6,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0