結果
問題 |
No.376 立方体のN等分 (2)
|
ユーザー |
![]() |
提出日時 | 2016-06-04 23:40:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 74,224 KB |
実行使用メモリ | 10,404 KB |
最終ジャッジ日時 | 2024-10-08 10:19:33 |
合計ジャッジ時間 | 24,349 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 TLE * 3 -- * 16 |
ソースコード
#include <iostream> #include <algorithm> #include <set> using namespace std; int main() { long n; cin>>n; set<long> s; long res=n-1; for(long i=1; i*i<=n; ++i) { if (n%i) continue; auto m=n/i; if (s.count(m)) continue; s.insert(m); for(long j=1; j*j<=m; ++j) { if (m%j) continue; res=min(res, i-1+j-1+m/j-1); } } cout<<res<<' '<<n-1<<endl; }