結果

問題 No.1139 Slime Race
ユーザー forest3forest3
提出日時 2023-07-16 18:03:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 3,166 ms
コンパイル使用メモリ 169,400 KB
実行使用メモリ 4,920 KB
最終ジャッジ日時 2023-10-17 16:34:26
合計ジャッジ時間 5,006 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 59 ms
4,920 KB
testcase_11 AC 53 ms
4,920 KB
testcase_12 AC 72 ms
4,920 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 58 ms
4,920 KB
testcase_15 AC 63 ms
4,656 KB
testcase_16 AC 69 ms
4,920 KB
testcase_17 AC 57 ms
4,920 KB
testcase_18 AC 47 ms
4,656 KB
testcase_19 AC 32 ms
4,348 KB
testcase_20 AC 32 ms
4,348 KB
testcase_21 AC 46 ms
4,656 KB
testcase_22 AC 58 ms
4,920 KB
testcase_23 AC 79 ms
4,920 KB
testcase_24 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	int N;
	long long D;
	cin >> N >> D;
	vector<long long> x( N );
	for( int i = 0; i < N; i++ ) {
		cin >> x[i];
	}
	vector<long long> v( N );
	for( int i = 0; i < N; i++ ) {
		cin >> v[i];
	}

	const long long INF = INT64_MAX / 2;
	auto f = [&]( __int128_t t ) -> __int128_t
	{
		__int128_t res = 0;
		for( int i = 0; i < N; i++ ) {
			res += v[i] * t;
		}
		return res;
	};

	long long l = 0;
	long long r = INF;
	while( r - l > 1 ) {
		long long m = (l + r) / 2;
		if( f( m ) >= D ) r = m;
		else l = m;
	}
	long long ans = r;

	cout << ans << endl;
}
0