結果

問題 No.808 Kaiten Sushi?
ユーザー noshi91noshi91
提出日時 2019-03-19 18:28:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,016 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 71,444 KB
実行使用メモリ 5,548 KB
最終ジャッジ日時 2023-10-12 03:24:35
合計ジャッジ時間 7,013 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,356 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 3 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 3 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 3 ms
4,348 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 73 ms
5,372 KB
testcase_33 AC 38 ms
4,348 KB
testcase_34 AC 40 ms
4,368 KB
testcase_35 AC 50 ms
4,860 KB
testcase_36 AC 38 ms
4,356 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 66 ms
5,236 KB
testcase_40 AC 16 ms
4,352 KB
testcase_41 AC 19 ms
4,352 KB
testcase_42 AC 56 ms
4,864 KB
testcase_43 AC 26 ms
4,348 KB
testcase_44 AC 43 ms
4,348 KB
testcase_45 AC 26 ms
4,356 KB
testcase_46 AC 15 ms
4,348 KB
testcase_47 AC 73 ms
5,340 KB
testcase_48 AC 73 ms
5,440 KB
testcase_49 AC 73 ms
5,344 KB
testcase_50 AC 73 ms
5,520 KB
testcase_51 AC 74 ms
5,548 KB
testcase_52 RE -
testcase_53 RE -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 1 ms
4,352 KB
testcase_57 WA -
testcase_58 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstddef>
#include<cstdint>
#include<iostream>
#include<limits>
#include<vector>

using isize = std::ptrdiff_t;
using usize = std::size_t;
using u64 = std::uint_fast64_t;

int main() {
	usize N;
	std::cin >> N;
	u64 L;
	std::cin >> L;
	std::vector<u64> x(N);
	for (auto &e : x) {
		std::cin >> e;
	}
	std::vector<u64> y(N);
	for (auto &e : y) {
		std::cin >> e;
	}

	x.emplace_back(std::numeric_limits<u64>::max());
	y.emplace_back(std::numeric_limits<u64>::max());

	isize count = 0, max = 0, min = 0;
	auto xitr = x.cbegin(), yitr = y.cbegin();
	u64 last;
	for (usize i = 0;i != N * 2;++i) {
		if (*xitr < *yitr) {
			++count;
			if (max <= count) {
				max = count;
				last = *yitr;
			}
			++xitr;
		}
		else {
			--count;
			if (count <= min) {
				min = count;
			}
			++yitr;
		}
	}
	const usize diff = max - min;
	if (max == static_cast<isize>(0)) {
		std::abort();
	}
	else if (min == static_cast<isize>(0)) {
		return 0;
	}
	else {
		std::cout << L*diff - (L - last) << std::endl;
	}
	return 0;
}
0