結果

問題 No.375 立方体のN等分 (1)
ユーザー ngtkanangtkana
提出日時 2020-04-05 19:44:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 947 bytes
コンパイル時間 2,013 ms
コンパイル使用メモリ 205,068 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 01:52:15
合計ジャッジ時間 6,769 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 RE -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 5 ms
4,376 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 6 ms
4,376 KB
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using lubl=long double;
void cmn(lint&x,lint y){if(x>y)x=y;}
void cmx(lint&x,lint y){if(x<y)x=y;}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<lint>div;
    for(lint i=1;i*i<=n;i++){
        if(n%i)continue;
        div.push_back(i);
        if(i*i!=n)div.push_back(n/i);
    }
    std::sort(ALL(div));
    lint min=n,max=0;
    int sz=div.size();
    for(lint i=0;i<sz;i++){
        lint x=div.at(i);
        if(n<x*x*x)continue;
        for(lint j=i;j<sz;j++){
            lint y=div.at(j);
            if(n<x*y*y)continue;
            lint z=n/(x*y);
            assert(x<=y&&y<=z);
            lint now=x+y+z-3;
            cmn(min,now);
            cmx(max,now);
        }
    }
    std::cout<<min<<' '<<max<<'\n';
}
0