結果

問題 No.3280 Black-Tailed Gull vs Monster
ユーザー elphe
提出日時 2025-09-27 11:48:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 994 bytes
コンパイル時間 3,266 ms
コンパイル使用メモリ 281,596 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-27 11:49:01
合計ジャッジ時間 5,748 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

[[nodiscard]] static inline constexpr std::vector<uint_least32_t> prepare(std::vector<uint_least32_t>&& F) noexcept
{
	std::sort(F.begin(), F.end());
	return std::move(F);
}

[[nodiscard]] static inline constexpr uint_fast32_t solve(const uint_fast32_t M, const uint_fast32_t X, const std::vector<uint_least32_t>& F) noexcept
{
	[[assume(std::is_sorted(F.begin(), F.end()))]];
	if (F[0] == X) return 2;
	for (uint_fast32_t i = 1; i < M; ++i)
	{
		if (F[i] == X) return 2;
		else if (F[i - 1] == F[i]) return 1;
	}

	return 0;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	
	uint_fast32_t N, X, Q;
	std::cin >> N >> X >> Q;

	uint_fast32_t total = 0;
	for (uint_fast32_t i = 0; i != Q; ++i)
	{
		uint_fast32_t M;
		std::cin >> M;
		std::vector<uint_least32_t> F(M);
		for (auto& f : F) std::cin >> f;

		total += solve(M, X, prepare(std::move(F)));
	}

	std::cout << std::fixed << std::setprecision(10) << total / 2.0 << '\n';
	return 0;
}
0