結果
| 問題 |
No.376 立方体のN等分 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-05 02:03:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 798 bytes |
| コンパイル時間 | 2,040 ms |
| コンパイル使用メモリ | 173,900 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-08 13:53:56 |
| 合計ジャッジ時間 | 5,461 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 15 RE * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
vector<ull> divisor(int n) {
vector<ull> res;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
res.emplace_back(i);
res.emplace_back(n / i);
}
}
sort(res.begin(), res.end());
return res;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ull n;
cin >> n;
ull tmax = n - 1;
ull tmin = tmax;
vector<ull> d = divisor(n);
for (int i = 0; d[i] * d[i] * d[i] <= n; i++) {
ull tmp = n / d[i];
for (int j = i; d[j] * d[j] <= tmp; j++) {
if (tmp % d[j]) continue;
tmin = min(tmin, d[i] + d[j] + tmp / d[j] - 3);
}
}
cout << tmin << " " << tmax << "\n";
return 0;
}