結果

問題 No.476 正しくない平均
ユーザー elphe
提出日時 2025-09-23 22:24:34
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 2,878 ms
コンパイル使用メモリ 277,856 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-23 22:24:38
合計ジャッジ時間 3,996 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

[[nodiscard]] static inline constexpr const char* solve(const uint_fast32_t n, const std::vector<uint_least32_t>& x, const uint_fast32_t a) noexcept
{
	if (std::accumulate(x.begin(), x.end(), UINT64_C(0)) == static_cast<uint_fast64_t>(n) * a)
		return "YES";
	else
		return "NO";
}

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

	uint_fast32_t n, a;
	std::cin >> n >> a;
	std::vector<uint_least32_t> x(n);
	for (auto& x : x) std::cin >> x;

	std::cout << solve(n, x, a) << '\n';
	return 0;
}
0