結果

問題 No.21 平均の差
ユーザー elphe
提出日時 2025-09-22 16:40:20
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 555 bytes
コンパイル時間 2,834 ms
コンパイル使用メモリ 277,964 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-22 16:40:23
合計ジャッジ時間 3,346 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

[[nodiscard]] static inline constexpr uint_fast32_t solve([[maybe_unused]] const uint_fast32_t N, [[maybe_unused]] const uint_fast32_t K, const std::vector<uint_least32_t>& n) noexcept
{
	const auto [min_itr, max_itr] = std::minmax_element(n.begin(), n.end());
	return *max_itr - *min_itr;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	
	uint_fast32_t N, K;
	std::cin >> N >> K;
	std::vector<uint_least32_t> n(N);
	for (auto& n : n) std::cin >> n;

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