結果
問題 | No.376 立方体のN等分 (2) |
ユーザー | itezpace |
提出日時 | 2016-10-08 07:53:46 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 913 bytes |
コンパイル時間 | 518 ms |
コンパイル使用メモリ | 64,988 KB |
実行使用メモリ | 10,144 KB |
最終ジャッジ日時 | 2024-05-01 15:26:58 |
合計ジャッジ時間 | 7,595 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 15 ms
6,940 KB |
testcase_03 | AC | 309 ms
6,940 KB |
testcase_04 | AC | 110 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 6 ms
6,944 KB |
testcase_09 | AC | 4 ms
6,944 KB |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main(){ ll N;cin>>N; ll T_MIN=N-1,T_MAX=N-1; vector<ll> v; ll N2=N; for(ll i=2;i*i<=N;++i){ while(1){ if(N2==1) break; if(N2%i==0){ N2/=i; v.push_back(i); } else { break; } } } if(N2!=1) v.push_back(N2); cerr<<endl; if(v.size()==1){ // } else if(v.size()==2){ ll a=v[0]; ll b=v[1]; T_MIN=a-1+b-1; } else { vector<ll> v2=v; do{ ll a=1; for(int i=0;i<v2.size()-2;++i){ a*=v2[i]; ll b=1; for(int j=i+1;j<v2.size()-1;++j){ b*=v2[j]; ll c=1; for(int k=j+1;k<v2.size();++k){ c*=v2[k]; } ll s=a+b+c; if(s-3<T_MIN) T_MIN=s-3; } } } while(next_permutation(v2.begin(),v2.end())); } cout<<T_MIN<<" "<<T_MAX<<endl; }