結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-22 17:29:58 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,072 bytes |
| コンパイル時間 | 2,767 ms |
| コンパイル使用メモリ | 283,036 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-22 17:30:03 |
| 合計ジャッジ時間 | 3,423 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘constexpr uint_fast32_t solve(uint_fast32_t, const std::vector<std::tuple<long unsigned int, long unsigned int, long unsigned int, long unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)’:
main.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
ソースコード
#include <bits/stdc++.h>
[[nodiscard]] static inline constexpr uint_fast32_t solve([[maybe_unused]] const uint_fast32_t N, const std::vector<std::tuple<uint_fast32_t, uint_fast32_t, uint_fast32_t, uint_fast32_t, std::string>>& hints) noexcept
{
std::bitset<10> possible_numbers((UINT32_C(1) << 10) - 1);
for (const auto& [a, b, c, d, r] : hints)
{
std::bitset<10> mask((UINT32_C(1) << a) | (UINT32_C(1) << b) | (UINT32_C(1) << c) | (UINT32_C(1) << d));
switch (r[0])
{
case 'Y':
possible_numbers &= mask;
break;
case 'N':
possible_numbers &= mask.flip();
break;
}
}
[[assume(possible_numbers.count() == 1)]];
for (uint_fast32_t i = 0; i != 10; ++i)
if (possible_numbers.test(i))
return i;
}
int main()
{
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
uint_fast32_t N;
std::cin >> N;
std::vector<std::tuple<uint_fast32_t, uint_fast32_t, uint_fast32_t, uint_fast32_t, std::string>> hints(N);
for (auto& [a, b, c, d, r] : hints)
std::cin >> a >> b >> c >> d >> r;
std::cout << solve(N, hints) << '\n';
return 0;
}