結果
| 問題 |
No.376 立方体のN等分 (2)
|
| コンテスト | |
| ユーザー |
Lay_ec
|
| 提出日時 | 2016-06-04 23:40:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 621 bytes |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 91,080 KB |
| 実行使用メモリ | 10,016 KB |
| 最終ジャッジ日時 | 2024-10-08 10:18:24 |
| 合計ジャッジ時間 | 7,782 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | TLE * 1 -- * 37 |
コンパイルメッセージ
In file included from main.cpp:4:
In function 'constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp) [with _Tp = long long int]',
inlined from 'int main()' at main.cpp:31:19:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/cmath:476:28: warning: 'M' may be used uninitialized [-Wmaybe-uninitialized]
476 | { return __builtin_sqrt(__x); }
| ~~~~~~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:31:27: note: 'M' was declared here
31 | long long M=sqrt(M);
| ^
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
using namespace std;
int main()
{
long long n;
cin>>n;
long long Tmin=2*n;
long long N=sqrt(n);
N++;
for(long long a=1;a<=n;++a){
if(n%a) continue;
long long m=n/a;
long long M=sqrt(M);
M++;
for(long long b=a;b<=M;++b){
if(m%b) continue;
long long c=m/b;
Tmin=min(Tmin,a+b+c);
}
}
cout<<Tmin-3<<" "<<n-1<<endl;
return 0;
}
Lay_ec