結果
問題 |
No.3280 Black-Tailed Gull vs Monster
|
ユーザー |
|
提出日時 | 2025-09-27 12:14:23 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 1,214 bytes |
コンパイル時間 | 3,132 ms |
コンパイル使用メモリ | 288,308 KB |
実行使用メモリ | 9,984 KB |
最終ジャッジ日時 | 2025-09-27 12:14:29 |
合計ジャッジ時間 | 5,184 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> [[nodiscard]] static inline uint_fast32_t check(const uint_fast32_t M, const uint_fast32_t X, const std::vector<uint_least32_t>& F) noexcept { std::unordered_map<uint_least32_t, uint_least32_t> count_of; count_of.reserve(M); for (const auto& f : F) ++count_of[f]; if (count_of.contains(X)) return 2; for (const auto& [key, count] : count_of) if (count >= 2) return 1; return 0; } [[nodiscard]] static inline double solve([[maybe_unused]] const uint_fast32_t N, const uint_fast32_t X, const uint_fast32_t Q, const std::vector<uint_least32_t>& M, const std::vector<std::vector<uint_least32_t>>& F) noexcept { uint_fast32_t total = 0; for (uint_fast32_t i = 0; i != Q; ++i) total += check(M[i], X, F[i]); return total / 2.0; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); uint_fast32_t N, X, Q; std::cin >> N >> X >> Q; std::vector<uint_least32_t> M(Q); std::vector<std::vector<uint_least32_t>> F(Q); for (uint_fast32_t i = 0; i != Q; ++i) { std::cin >> M[i]; F[i].resize(M[i]); for (auto& f : F[i]) std::cin >> f; } std::cout << std::fixed << std::setprecision(10) << solve(N, X, Q, M, std::move(F)) << '\n'; return 0; }