結果
| 問題 | 
                            No.3331 Consecutive Cubic Sum
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-11-02 21:31:34 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 5 ms / 5,000 ms | 
| コード長 | 782 bytes | 
| コンパイル時間 | 2,997 ms | 
| コンパイル使用メモリ | 278,184 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-11-02 21:33:29 | 
| 合計ジャッジ時間 | 4,695 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge7 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 47 | 
ソースコード
#include <bits/stdc++.h>
[[nodiscard]] static inline constexpr std::vector<std::pair<uint_least32_t, uint_least32_t>> solve(const uint_fast64_t N) noexcept
{
	std::vector<std::pair<uint_least32_t, uint_least32_t>> ans;
	ans.reserve(1'000'000);
	for (uint_fast64_t L = 1, R = 1, sum = 1; L * L * L <= N; sum -= L * L * L, ++L)
	{
		while (sum < N) ++R, sum += R * R * R;
		if (sum == N) ans.emplace_back(L, R);
	}
	return ans;
}
static inline void output(const std::vector<std::pair<uint_least32_t, uint_least32_t>>& ans) noexcept
{
	std::cout << ans.size() << '\n';
	for (const auto& [l, r] : ans)
		std::cout << l << ' ' << r << '\n';
}
int main()
{
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	uint_fast64_t N;
	std::cin >> N;
	output(solve(N));
	return 0;
}