結果
問題 |
No.29 パワーアップ
|
ユーザー |
|
提出日時 | 2025-09-22 19:58:51 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 757 bytes |
コンパイル時間 | 3,100 ms |
コンパイル使用メモリ | 278,660 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-22 19:58:56 |
合計ジャッジ時間 | 4,110 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> [[nodiscard]] static inline constexpr uint_fast32_t solve([[maybe_unused]] const uint_fast32_t N, const std::vector<std::array<uint_least32_t, 3>>& drops) noexcept { std::array<uint_fast32_t, 11> count_of = { 0, }; for (const auto& [a, b, c] : drops) ++count_of[a], ++count_of[b], ++count_of[c]; uint_fast32_t ans = 0; for (auto& c : count_of) ans += c / 2, c %= 2; return ans + std::accumulate(count_of.begin(), count_of.end(), UINT32_C(0)) / 4; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); uint_fast32_t N; std::cin >> N; std::vector<std::array<uint_least32_t, 3>> drops(N); for (auto& [a, b, c] : drops) std::cin >> a >> b >> c; std::cout << solve(N, drops) << '\n'; return 0; }