結果

問題 No.808 Kaiten Sushi?
ユーザー noshi91noshi91
提出日時 2019-03-17 21:06:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,029 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 71,560 KB
実行使用メモリ 5,552 KB
最終ジャッジ日時 2023-10-12 01:28:28
合計ジャッジ時間 4,766 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,368 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 AC 2 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 4 ms
4,352 KB
testcase_10 AC 3 ms
4,352 KB
testcase_11 AC 2 ms
4,356 KB
testcase_12 AC 3 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 3 ms
4,352 KB
testcase_16 AC 3 ms
4,352 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 29 ms
4,352 KB
testcase_24 AC 24 ms
4,352 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 73 ms
5,500 KB
testcase_33 AC 37 ms
4,356 KB
testcase_34 AC 41 ms
4,440 KB
testcase_35 AC 51 ms
4,784 KB
testcase_36 AC 38 ms
4,436 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 66 ms
5,156 KB
testcase_40 AC 16 ms
4,352 KB
testcase_41 AC 20 ms
4,348 KB
testcase_42 AC 56 ms
4,972 KB
testcase_43 AC 25 ms
4,348 KB
testcase_44 AC 43 ms
4,444 KB
testcase_45 AC 25 ms
4,352 KB
testcase_46 AC 15 ms
4,352 KB
testcase_47 AC 74 ms
5,400 KB
testcase_48 AC 73 ms
5,412 KB
testcase_49 AC 74 ms
5,552 KB
testcase_50 AC 74 ms
5,360 KB
testcase_51 AC 73 ms
5,492 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 1 ms
4,352 KB
testcase_55 AC 1 ms
4,352 KB
testcase_56 AC 2 ms
4,348 KB
testcase_57 AC 23 ms
4,352 KB
testcase_58 AC 40 ms
4,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:58:22: 警告: ‘last’ may be used uninitialized [-Wmaybe-uninitialized]
   58 |         ans = L*diff - (L - last);
      |               ~~~~~~~^~~~~~~~~~~~
main.cpp:30:13: 備考: ‘last’ はここで定義されています
   30 |         u64 last;
      |             ^~~~

ソースコード

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;
	u64 ans;
	/*
	if (max == static_cast<isize>(0)) {
		ans = L*diff + y.front();
	}
	else {
		ans = L*diff - (L - last);
	}
	*/
	ans = L*diff - (L - last);
	std::cout << ans << std::endl;
	return 0;
}
0