結果

問題 No.3155 Same Birthday
ユーザー elphe
提出日時 2025-07-12 17:41:44
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 85,552 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2025-07-12 17:41:51
合計ジャッジ時間 6,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <array>
#include <vector>

static inline constexpr const char* solve(const uint_fast32_t N, const std::vector<uint_fast16_t>& A, const std::vector<uint_fast16_t>& B) noexcept
{
	std::array<bool, (UINT32_C(1) << 20)> is_included = { false, };
	for (uint_fast32_t i = 0; i != N; ++i)
	{
		if (is_included[(A[i] << 10) | B[i]])
			return "Yes";
		is_included[(A[i] << 10) | B[i]] = true;
	}

	return "No";
}

int main()
{
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);

	uint_fast32_t N, i;
	std::cin >> N;
	std::vector<uint_fast16_t> A(N), B(N);
	for (i = 0; i != N; ++i)
		std::cin >> A[i] >> B[i];

	std::cout << solve(N, A, B) << '\n';
	return 0;
}
0