結果
| 問題 | No.3331 Consecutive Cubic Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-29 00:38:39 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 52 ms / 5,000 ms |
| + 938µs | |
| コード長 | 696 bytes |
| 記録 | |
| コンパイル時間 | 3,181 ms |
| コンパイル使用メモリ | 181,684 KB |
| 実行使用メモリ | 19,064 KB |
| 最終ジャッジ日時 | 2026-10-29 00:38:48 |
| 合計ジャッジ時間 | 8,840 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 |
ソースコード
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
int main() {
using namespace std;
ios::sync_with_stdio(false);
cin.tie(nullptr);
using u128 = __uint128_t;
constexpr u128 M = 1000100;
vector<u128> acc(M, 0);
for (u128 i = 1; i < M; i++) { acc[i] = acc[i - 1] + i * i * i; }
long long n;
cin >> n;
vector<pair<int, int>> ans;
for (int l = 0; l < static_cast<int>(M); l++) {
int r = lower_bound(acc.begin(), acc.end(), acc[l] + n) - acc.begin();
if (acc[l] + n == acc[r]) { ans.emplace_back(l + 1, r); }
}
cout << ans.size() << "\n";
for (auto [l, r] : ans) { cout << l << " " << r << "\n"; }
}